I am currently writing an automation script for mac that takes control of time machine to run the backup at night. the script is wotking when running from a terminal, interaction as expected with time machine but when i try to run it using a launchDaemon the time machine command seems to be omitted. any idea why that is? Any help/insight would be greatly appreciated
the .plist file is root-owned and has a mod set at 600 (recommended by apple docs)
Here is the content of my .plist file:
<?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>local.automation</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>/Users/<username>/<project>/automation.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>LaunchOnlyOnce</key>
<true/>
</dict>
</plist>
the automation.sh file is also a root-owned file and the mod is set at 777. the content goes as follows:
#!/bin/bash
PASS=$(security find-generic-password -l 'root password' -a dl -w | tr -d '\n')
echo "$PASS" | sudo -S tmutil disable