launchd

Spawn a screen session from launch daemon

别等时光非礼了梦想. 提交于 2019-12-05 13:57:17
I've written a launchd .plist which should attach a debugger to the WindowServer when it launches. The main part of the script looks like screen -D -m -S "WindowServer Debugger" \ gdb \ -x $GDBSCRIPT \ /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/WindowServer \ $WSPID This starts a detached screen session in which gdb is attached to WindowServer. However, this seems to trigger an error condition in launchd under Snow Leopard, causing it to spout out error messages to the log: com.apple.launchd[1] (0x10011c070

Mac OS X: Launching an app using NSWorkspace from a daemon doesn't work if the daemon is run as root

佐手、 提交于 2019-12-05 02:20:21
问题 I created a Command Line Tool app using Xcode. In that app, I used NSWorkspace to launch another application bundle (.app) as suggested here. MacOsX: How to launch an application (.app) from a "Command Line Tool" type of app All seem to work fine until I tried to start that Command Line Tool app as a daemon using launchctl. If the daemon is run as the currently logged in user, then the Command Line Tool app launches the external app just fine. If the daemon is run as root, then the Command

OS X: Auto start PHP FCGI via launchd on system start

╄→гoц情女王★ 提交于 2019-12-05 02:09:29
问题 So, I installed PHP5 FCGI from MacPorts along with nginx and mysql. Last two are loading fine during system start. But PHP doesn't. I created a file /opt/local/etc/LaunchDaemons/org.macports.php5/org.macports.php5-cgi.plist and put this contents to it: <?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>org.macports.php5-cgi</string> <key

LaunchEvents key unrecognized in launchd plist (detecting USB device)

跟風遠走 提交于 2019-12-05 00:55:19
问题 I want to launch a specific app when a USB device is plugged in to a Mac OS X system. I've followed the recipe given in this SO post. But it appears the LaunchEvents key is not recognized: When I reboot my system, I see the following message on the console: com.apple.launchd.peruser.501[173] (com.example.program) Unknown key for dictionary: LaunchEvents I am running OS X 10.6.8, and it's entirely possible that xpc_events aren't supported in this version of OS X. If this is the case, what are

Using launchd on IOS to restart app

六月ゝ 毕业季﹏ 提交于 2019-12-05 00:15:17
问题 I am using some iPads in a museum exhibition, running an app developed by others. Even though we've covered the Home button, I'm finding that occasionally the app crashes, leaving the user at the Home screen. From here they can access other unauthorised apps. The museum is not averse to jailbreaking the iPad if that will give us the solution we require, so I have been doing some research into the idea of using launchd with the KeepAlive tag and putting the .plist file into the /Library

Launchd.plist with WatchPaths key: How to set a minimum interval?

佐手、 提交于 2019-12-05 00:11:34
问题 How would one set a minimum interval for a launchd.plist script with a WatchPath key? For example, I want to run a script every time new files appear in a directory, but I would like it to only run once an hour at maximum. The launchd.plist might look something like this: <?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.me.pytag<

How can I start a Program.app with LaunchDaemons (launchd)?

為{幸葍}努か 提交于 2019-12-04 17:08:48
I've placed the following com.apple.test.plist file in the folder: /System/Library/LaunchDaemons <?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.apple.Spotlight</string> <key>ProgramArguments</key> <array> <string>/Users/todd/Dropbox/client/CLIENT.BUILDS/MAC/v0.1/ApplicationTest.app</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist> But for some reason ApplicationTest.app does not start when i login with my user todd. Any

Can I import a Golang package based on the OS I'm building for?

房东的猫 提交于 2019-12-04 14:57:31
Say I have a go project that based on which OS, and in some cases which distro, I want to use say a Systemd client package vs an Upstart client package vs a sysv client package vs a launchd client package. Is it possible to selectively import each package so I only import the one I need per OS/distro I'm building for? Or do I have to import each package for each OS/distro? Package build Build Constraints A build constraint, also known as a build tag, is a line comment that begins // +build that lists the conditions under which a file should be included in the package. Constraints may appear in

How can I make a program start up automatically in OSX?

为君一笑 提交于 2019-12-04 07:31:57
I have a little program that I want to make open automatically when my mac is started up. Because this program accepts command line arguments, its not as simple as just going to System Prefs/Accounts/Login items and adding it there... From google, I read that I can create a .profile file in my user's home folder, and that will execute whatever I put in it... So I have a .profile page in ~ like this: -rw-r--r--@ 1 matt staff 27 27 Sep 13:36 .profile That contains this... /Applications/mousefix 3.5 But it doesn't execute on startup! If I enter "/Applications/mousefix 3.5" manually into the

Is it possible to detect Power Nap / DarkWake mode in OSX

这一生的挚爱 提交于 2019-12-04 06:37:25
I have a daemon process started via launchd. This will be running even during DarkWake and has no time to finish before OS X goes back to sleep again. I can think of the following solutions, but didn't find a way to achieve this. Don't make this daemon process run during DarkWake. I went through Apple documentation and forums but didn't find any reference for this. During DarkWake via daemon process make the OS wait until its done. Tried with calling pmset noidle and caffeinate in daemon process. It didn't work. OS X went to sleep. It seems OS X suppresses the delivery of many notifications