For backup purposes, I want to write out an individualized launch agent plist via a shell script to certain Macs.
This script should at first gather two variables locally (currently logged in user and a user specific storage directory, I would technically know how to get both of them), but then successfully hand over these two variables to an individualized launch agent created by the same script, doing watch paths on certain directories for running a backup script as soon as there is a change to the root directories.
How could I leverage this?
Thank you and best regards
below please find a script I use to create a launch agent or launch daemon, depending om how the script variables are customized. I also added logic to get the current logged in user, if you need that. Hope this is helpful.