Add support for LaunchAgents on macOSX
itskingori opened this issue · comments
Summary
I'd like to add support for LaunchAgents (user daemons in macOSX). Use case is I'd like to use this package to manage user daemons. Here's kind of the overview of the differences:
Details
Currently this package supports only LaunchDaemons
:
Lines 9 to 10 in aa76b00
I'm wondering if you would consider adding support for LaunchAgents
? Seems where we create the .plist
file is the biggest difference (well, that and I guess permissions since it would run as the logged in user):
Lines 28 to 31 in aa76b00
I'd like to take a stab at adding support for this. So consider this a scoping exercise of sorts to:
- Gauge your interest - is this something you'd like me to contribute to your library?
- Get feedback on approach - before I write any code, wanna know: are you're ok with the approach below?
On approach, I'm thinking of updating darwinRecord
to have an userAgent bool
field ...
Lines 17 to 21 in aa76b00
Actual implementation might be slightly different but the idea is provide a way to know what type of deamon we want and then internally change the flow based on use case e.g. use /Library/LaunchAgents/
instead of /Library/LaunchDaemons/
when it's a user daemon, etc.
Lemme know what you think.
References
- https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html
- https://apple.stackexchange.com/questions/290945/what-are-the-differences-between-launchagents-and-launchdaemons
- https://ieftimov.com/post/create-manage-macos-launchd-agents-golang/
- https://launchd.info/
A very good proposal.
Alright, thanks. Will take create a PR and we can take it from there.
See PR #90.
Resolved in #90