[MacTUG] Running a LaunchDaemon at login

Donald Duff-McCracken dsmccrac at uwaterloo.ca
Thu Dec 14 15:15:33 EST 2017


In my lab environment, I run a few launch agents and launch daemons. I use the agents for commands that I want ran as the current user, and the daemons for commands that need to be ran as root. I want all of them to run at login. This is easy for Agents (as it is sort of what they were made to do) and the ‘runatload’ program argument does this for them. However for a daemon, runatload causes the daemon to run at startup. However there are other program arguments that can be helpful getting a daemon to run at login in my environment. The program argument ‘startonmount’ runs the daemon when a volume is mounted. In my environment, the macs are bound to AD and the N-Drive gets automatically mounted after login. This is enough to trigger the ‘startonmount’ argument and the daemon runs!

BTW there are all sorts of other clever ways you can get an agent or daemon to run. You could get it to run every x seconds, or at a specific calendar time, or every time a path is modified, etc. http://www.launchd.info/ is a good primer on these

------------------------------------
Donald Duff-McCracken
Technical Services Manager
Mapping, Analysis & Design
Faculty of Environment
University of Waterloo
(519) 888-4567 x32151
https://uwaterloo.ca/environment-computing/about/people
------------------------------------
This email communication is intended as a private communication for the sole use of the primary addressee and those individuals listed for copies in the original message. The information contained in this email is private and confidential and If you are not an intended recipient you are hereby notified that copying, forwarding or other dissemination or distribution of this communication by any means is prohibited.  If you are not specifically authorized to receive this email and if you believe that you received it in error please notify the original sender immediately.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uwaterloo.ca/pipermail/mactug/attachments/20171214/b5495910/attachment.html>


More information about the MacTUG mailing list