VERY simple Launchd plist not running my script

Just in case anyone else runs across this issue, and already has <key>RunAtLoad</key><true/> in their plist, I want to provide some additional solutions. Double check permissions to make sure that your script is executable (look for an ‘x’): ls -l /opt/apache-tomcat-5.5.27/bin/startup.sh Modify permissions if necessary: chmod +x /opt/apache-tomcat-5.5.27/bin/startup.sh Also run the script directly first and … Read more

How to limit memory of a OS X program? ulimit -v neither -m are working

You can’t. Apple can (using the ledger() system call, which is private), but you can’t. I’m not entirely sure whether launchd’s options work or not – certainly if it was still using the code visible in the last open source version (from 10.9.5), it wouldn’t, because it calls setrlimit(), but it’s been substantially rewritten since … Read more

How can I debug a Launchd script that doesn’t run on startup?

Best way I found to debug, in your plist: <key>StandardErrorPath</key> <string>/tmp/mycommand.err</string> <key>StandardOutPath</key> <string>/tmp/mycommand.out</string> Open Console app, in “All Messages” you should see entries when your app fails or succeeds. Like this: 4/28/15 10:43:19.938 AM com.apple.xpc.launchd[1]: (mycommand[18704]) Service exited with abnormal code: 1 The issue I had was with ProgramArguments takes each item of command as … Read more

Scheduling a terminal command or script file to run daily at a specific time Mac OS X

As @TheDarkKnight points out, cron has been deprecated in favor of launchd. To use launchd, save the following as com.example.volume.plist in ~/Library/LaunchAgents/: <?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”> <plist version=”1.0″> <dict> <key>Label</key> <string>com.example.volume</string> <key>ProgramArguments</key> <array> <string>sh</string> <string>-c</string> <string>set volume 1.7</string> </array> <key>StartCalendarInterval</key> <dict> <key>Hour</key> <integer>23</integer> <key>Minute</key> <integer>45</integer> </dict> </dict> </plist> then … Read more

What’s a clean way to stop mongod on Mac OS X?

It’s probably because launchctl is managing your mongod instance. If you want to start and shutdown mongod instance, unload that first: launchctl unload -w ~/Library/LaunchAgents/org.mongodb.mongod.plist Then start mongod manually: mongod -f path/to/mongod.conf –fork You can find your mongod.conf location from ~/Library/LaunchAgents/org.mongodb.mongod.plist. After that, db.shutdownServer() would work just fine. Added Feb 22 2014: If you have … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)