Launchd
From Wasya Wiki
Revision as of 20:23, 8 September 2018 by Piousbox (Talk | contribs) (Created page with " == Startup Scripts == From: https://medium.com/@fahimhossain_16989/adding-startup-scripts-to-launch-daemon-on-mac-os-x-sierra-10-12-6-7e0318c74de1 Agent is run on behalf of...")
Startup Scripts
Agent is run on behalf of the logged in user while a daemon runs on behalf of the root
/Library/LaunchAgents/com.mongodb.mongodb.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.mongodb.mongodb</string> <!-- org.mongodb.mongodb perhaps? --> <key>OnDemand</key> <false/> <key>Disabled</key> <false /> <key>UserName</key> <string>piousbox</string> <key>GroupName</key> <string>wheel</string> <key>ProgramArguments</key> <array> <string>/usr/local/lib/mongodb/bin</string> </array> </dict> </plist>
The -w flag makes it load always on startup.
sudo launchctl unload -w /Library/LaunchAgents/com.mongodb.mongodb.plist sudo launchctl load -w /Library/LaunchAgents/com.mongodb.mongodb.plist