launchctl

Get launchd to run task when network connects or reconnects

本小妞迷上赌 提交于 2020-08-20 12:23:30
问题 I run a custom python script to update various dynamic DNS servers through launchctl and it runs every 15 minutes. This is both overkill and underkill. It would be nice if the script would execute only when reachability changes, and then as a fallback maybe every 30 minutes. I could easily enough update the Python script to check if the external address has changed before calling the update, but if my connection goes down and comes back up with a different IP address, I wouldn't want to have

Enable, disable and start services programmatically in macOS

我们两清 提交于 2020-01-14 13:43:29
问题 I am writing a program that comes with a service. What I did so far is to create a helper tool that can run elevated tasks for my process and can communicate via XPC. My program comes bundled with a service and I want to use the helper tool to install and start/stop this service so my program can have a checkbox "start service with system" in the settings. I can successfully copy the plist for the service, but I cannot find any way to enable, disable, start or stop the service

launchd: Managing a Java Jar

蓝咒 提交于 2019-12-11 03:44:29
问题 I have the following launchd configuration (stored in acme.plist ) which I load and start using launchctl load acme.plist and launchctl start acme.plist respectively. <?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.acme</string> <key>ProgramArguments</key> <array> <string>/usr/bin/java</string> <string>-jar /usr/local/acme/acme-latest.jar<