MacOS/Creating Launch Daemons and Agents: Difference between revisions
Jump to navigation
Jump to search
(Created page with "==Plist== <source lang="xml"> <!-- cp /usr/local/opt/chorke/academia/etc/init.d/sa.com.medisys.amqpd.startup.plist --> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist P...") |
(→Plist) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Plist== | ==Plist== | ||
<source lang="xml"> | <source lang="xml"> | ||
<!-- cp /usr/local/opt/chorke/academia/etc/init.d/ | <!-- cp /usr/local/opt/chorke/academia/etc/init.d/org.chorke.academia.amqpd.startup.plist --> | ||
<?xml version="1.0" encoding="UTF-8"?> | <?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"> | <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
Line 12: | Line 12: | ||
<key>LaunchOnlyOnce</key> <true/> | <key>LaunchOnlyOnce</key> <true/> | ||
<key>ProgramArguments</key> | <key>ProgramArguments</key> | ||
<array> | |||
<string>/usr/local/opt/chorke/academia/etc/init.d/amqpd</string> | |||
<string>restart</string> | |||
</array> | |||
<key>StandardErrorPath</key> <string>/tmp/amqpd.err</string> | |||
<key>StandardOutPath</key> <string>/tmp/amqpd.out</string> | |||
</dict> | </dict> | ||
</plist> | </plist> | ||
</source> | </source> | ||
==Debug== | |||
sudo launchctl load -w /Library/LaunchDaemons/org.chorke.academia.amqpd.startup.plist | |||
sudo launchctl unload -w /Library/LaunchDaemons/org.chorke.academia.amqpd.startup.plist | |||
sudo launchctl start -w /Library/LaunchDaemons/org.chorke.academia.amqpd.startup.plist | |||
sudo launchctl stop /Library/LaunchDaemons/org.chorke.academia.amqpd.startup.plist | |||
cat /private/var/db/launchd.db/com.apple.launchd/overrides.plist | |||
cat /tmp/amqpd.err | |||
cat /tmp/amqpd.out | |||
==Where== | ==Where== | ||
Line 28: | Line 40: | ||
==References== | ==References== | ||
* [https://stackoverflow.com/questions/6337513 How can I debug a Launch script] | |||
* [http://cdn.chorke.org/wiki/MacOS/Creating_Launch_Daemons_and_Agents Creating Launch Daemons and Agents] | * [http://cdn.chorke.org/wiki/MacOS/Creating_Launch_Daemons_and_Agents Creating Launch Daemons and Agents] | ||
* [https://medium.com/@fahimhossain_16989/adding-startup-scripts-to-launch-daemon-on-mac-os-x-sierra-10-12-6-7e0318c74de1 Adding Startup Scripts to Launch Daemon] |
Latest revision as of 04:19, 13 June 2019
Plist
<!-- cp /usr/local/opt/chorke/academia/etc/init.d/org.chorke.academia.amqpd.startup.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>org.chorke.academia.amqpd.startup</string>
<key>Disabled</key> <false/>
<key>RunAtLoad</key> <true/>
<key>KeepAlive</key> <false/>
<key>LaunchOnlyOnce</key> <true/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/chorke/academia/etc/init.d/amqpd</string>
<string>restart</string>
</array>
<key>StandardErrorPath</key> <string>/tmp/amqpd.err</string>
<key>StandardOutPath</key> <string>/tmp/amqpd.out</string>
</dict>
</plist>
Debug
sudo launchctl load -w /Library/LaunchDaemons/org.chorke.academia.amqpd.startup.plist sudo launchctl unload -w /Library/LaunchDaemons/org.chorke.academia.amqpd.startup.plist sudo launchctl start -w /Library/LaunchDaemons/org.chorke.academia.amqpd.startup.plist sudo launchctl stop /Library/LaunchDaemons/org.chorke.academia.amqpd.startup.plist
cat /private/var/db/launchd.db/com.apple.launchd/overrides.plist cat /tmp/amqpd.err cat /tmp/amqpd.out
Where
/System/Library/LaunchDaemons/ /System/Library/LaunchAgents/
/Library/LaunchDaemons/ /Library/LaunchAgents/