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