launchd

LaunchD Plist not working

人盡茶涼 提交于 2019-12-08 01:11:57
问题 EDIT: It appears as if I am getting an error in the console com.apple.launchd: (com.xxxx.adbind[57]) Exited with code: 1 What does that even mean? Also; if I load the launchd plist file logged in by using the launchctl command it works fine! I'm driving myself crazy trying to figure out why my launchd is not working. I'm using this in Mountain Lion 10.8.2 When I manually start it using launchctl it says it's loaded, but the script is not running. The script when ran manually works fine as

Send Stderr to dev/null but if no error occurs, continue on

与世无争的帅哥 提交于 2019-12-07 18:46:29
问题 I have a shell script that I run in launchd that backs up my MAMP MySQL install. Unfortunately if MAMP isn't running it throws an error and sends it to internal mail. I want any errors to be ignored (sent to /dev/null ), but if there isn't an error, to continue on. I have attempted the following, which correctly creates the backup when MAMP is running, but sends mail if it's not running (stderr): #!/bin/bash /Applications/MAMP/Library/bin/mysqldump --opt -u root -pPASSWORDHERE --host

launchd file runs manually but not automatically

若如初见. 提交于 2019-12-07 13:42:07
问题 I have written a plist file and placed it into /Library/LaunchDaemons <?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.dotcafe.DCDMySQLBackup</string> <key>ProgramArguments</key> <array> <string>/Users/robdando/Webserverbackup/grab.sh</string> </array> <key>StartInterval</key> <integer>900</integer> </dict> </plist> I have now got the script

launchd: sleep in GCD managed signal handler

给你一囗甜甜゛ 提交于 2019-12-06 19:36:29
I encounter a strange situation in a launchd managed daemon when I try to sleep in the SIGTERM handler that is managed with Grand Central Dispatch as described here . Everything works fine and I do get a SIGTERM signal handler before receiving a SIGKILL when I do not sleep in the SIGTERM handler. But as soon as I do sleep -- even for extremly short amounts of time like a usleep(1); -- I do not get a SIGTERM handler at all but instead my daemon is SIGKILLed instantly by launchd. Btw I am using EnableTransactions in my plist file and the proper vproc_transaction_begin(3) / vproc_transaction_end

Mac : Launch command when device connected by bluetooth

和自甴很熟 提交于 2019-12-06 13:43:22
I would like to launch a shell command when a specific external bluetooth device is connected to my Mac. A nice way (without installing third party software) to do that is by adding a plist file in ~/Library/LaunchAgents On this page , there is an example of launching an event when the wifi connects to a specific location. It is done by watching a specific file : <key>WatchPaths</key> <array> <string>/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist</string> </array> Do you think it'd possible to do the same with bluetooth events ? Thanks for your help ! iero Create

Running a Shell Script on Shutdown via launchd

你离开我真会死。 提交于 2019-12-06 11:49:54
Since startup items and rc commands are both deprecated (and in many cases not working at all) on OS X in favour of launchd , I'd like to find out what the correct way would be to setup a shell script that runs on logout/shutdown. For a startup item it was possible to create a shell script that looked something like: #!/bin/sh StartService() { echo "Started." } StopService() { echo "Stopped." } RunService "$1" But the RunService command isn't supported when running a script from launchd , and I'm not sure it's meant to be used anymore anyway. If possible, I'd like to create a shell script that

LaunchD Plist not working

99封情书 提交于 2019-12-06 09:30:52
EDIT: It appears as if I am getting an error in the console com.apple.launchd: (com.xxxx.adbind[57]) Exited with code: 1 What does that even mean? Also; if I load the launchd plist file logged in by using the launchctl command it works fine! I'm driving myself crazy trying to figure out why my launchd is not working. I'm using this in Mountain Lion 10.8.2 When I manually start it using launchctl it says it's loaded, but the script is not running. The script when ran manually works fine as well. Perhaps it just needs a better set of eye's to look at what I'm doing. First, I'll explain what it

Send Stderr to dev/null but if no error occurs, continue on

给你一囗甜甜゛ 提交于 2019-12-06 05:54:34
I have a shell script that I run in launchd that backs up my MAMP MySQL install. Unfortunately if MAMP isn't running it throws an error and sends it to internal mail. I want any errors to be ignored (sent to /dev/null ), but if there isn't an error, to continue on. I have attempted the following, which correctly creates the backup when MAMP is running, but sends mail if it's not running (stderr): #!/bin/bash /Applications/MAMP/Library/bin/mysqldump --opt -u root -pPASSWORDHERE --host=localhost --all-databases > | gzip -9 > /Users/Paul/Dropbox/Development/Shared\ DBs/BACKUPS/all_databases_-

Run daemon as another user on mac os x

半世苍凉 提交于 2019-12-06 04:05:11
I'm trying right now to create separate user for jenkins on Mac Os and run it with this user. I've created a new user: # Create the group sudo dscl . create /Groups/jenkins sudo dscl . create /Groups/jenkins PrimaryGroupID 300 # Create the user sudo dscl . create /Users/jenkins sudo dscl . create /Users/jenkins PrimaryGroupID 300 sudo dscl . create /Users/jenkins UniqueID 300 sudo dscl . create /Users/jenkins UserShell /bin/bash # Set the users pasword sudo dscl . passwd /Users/jenkins 123qweASD # Add the user to the group sudo dscl . append /Groups/jenkins GroupMembership jenkins And the I

MacPorts Apache2 Stopped Launching on Boot

二次信任 提交于 2019-12-06 00:05:24
问题 Something that I've noticed recently on two different machines is that Apache2 installed via MacPorts seems to have stopped launching when I boot up. The honest truth is that I can't swear it did so before, but it's something I think I'd notice because installing the LaunchDaemon is part of my install process. In fact, if I try to reload the LaunchDaemon, it fails: $ sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist org.macports.apache2: Already loaded Unless I start