0
我一直在阅读本主题:Running script upon login mac,并尝试遵循使用launchctl创建在登录时自动运行的bash shell脚本的指导原则。我只是无法让它工作!我想要启动的shell脚本如下:在Mac OS X上运行launchctl登录脚本时遇到困难
#!/bin/bash
#
# Shell script to start the RobotFramework Auto-Started Servers.
#
# Copyright (c) 2014 Texas Instruments, Inc.
#
#-------------------------------------------------------------------------------
#
#
# Start the dispatcher as an independent background task with its own virtual screen
#
cd /Users/epsqainfprod/RobotFramework/Extensions/Dispatcher
screen -S Dispatcher -d -m ./StartDispatcher.sh
#
# Start the RunProcServer
#
cd /Users/epsqainfprod/RobotFramework/Extensions/RunProcess
screen -S RunProcServer -d -m ./RunProcServer.sh
#
# -------------------------------- End of file --------------------------------
如果我从命令行调用它,它可以正常工作,创建两个独立运行的屏幕进程。我创建了这个文件的.plist,以下从引用的岗位说明:
cat ~/Library/LaunchAgents/com.user.loginscript.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.loginscript</string>
<key>Program</key>
<string>/Users/epsqainfprod/TEMP/AutoStartScripts.sh</string>
<key>RunAtLoad</key>
<true/>
</dict>
在上述shell脚本文件/Users/epsqainfprod/TEMP/AutoStartScripts.sh
英寸我已经检查了system.log,它显示的是:
Dec 2 08:05:49 epsqainf5lab15.itg.ti.com login[2109]: USER_PROCESS: 2109 ttys000
Dec 2 08:05:49 epsqainf5lab15.itg.ti.com login[2109]: DEAD_PROCESS: 2109 ttys000
Dec 2 08:07:33 epsqainf5lab15.itg.ti.com login[2117]: USER_PROCESS: 2117 ttys000
Dec 2 08:07:33 epsqainf5lab15.itg.ti.com login[2117]: DEAD_PROCESS: 2117 ttys000
所以我完全被难住了。有没有人有任何建议如何得到这个工作?
在脚本的开头添加一些命令,例如'date >>/tmp/debug.txt',看看它们有多少被执行。 – 2014-12-02 14:59:47
尝试运行'which screen'在终端中获取其完整路径并在脚本中使用它,而不是简单的'screen'。 – 2014-12-02 15:10:23