I've created the file /System/Library/LaunchDaemons/com.rundeckd.plist
with this content:
<?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>Disabled</key>
<true/>
<key>Label</key>
<string>com.rundeckd</string>
<key>ProgramArguments</key>
<array>
<string>/test/rundeck/server/sbin/rundeckd</string>
<string>start</string>
</array>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/test/rundeck/var/log/launchd_out.log</string>
<key>StandardErrorPath</key>
<string>/test/rundeck/var/log/launchd_sdd.log</string>
<key>Debug</key>
<true/>
</dict>
</plist>
However, sudo launchctl list does not show this rundeckd.
why?
also, rundeckd does not run it at boot time, nor the log files are never created. (note, i've modified rundeckd to have the required $RDECK_BASE env variable hard-coded in the script)
Update
Gordon Davisson, I've modified the plist as you said, and without modifying the rundeckd script, I get the following:
nohup: can't detach from console: Inappropriate ioctl for device
then, I have tried adding the option "launchd" to rundeckd (currently, there was start, stop and status), as follows:
launchd() {
echo "%s" "launchd $prog: "
touch $LOK_FILE
$rundeckd 2>&1 >>$RDECK_BASE/var/log/service.log &
PID=$!
echo $PID > $PID_FILE
fg $PID # block until it is stopped
}
but I get the error fg: no job control
, as it seems that I cannot run "fg" because it is not an interactive shell.
https://stackoverflow.com/questions/11821378/what-does-bashno-job-control-in-this-shell-mean