Hello,
I am trying to have a daily backup job run through launchd at 3:00am and I cannot seem to have a daemon with my script loaded automatically at boot time.
The script (backup.sh) works fine when I execute it directly and manually.
I have created a property list file which I stored in /Library/LaunchDaemons. The file is named "com.lanceloz.backupfile.plist" which is owned by root and has the -rw-r--r-- ownership.
My problem is that this plist is not automatically loaded at boot time. My understanding was that plists stored in /Library/LaunchDaemons would have to be loaded automatically at boot. But it does not appear to be so.
At boot, when I check what is loaded with "launchctl list", it does not appear in the list. But if i load it manually with "lauchctl load com.lanceloz.backupfile.plist", it works and appear in the list of active daemons.
As far as the content of the file, where I am using <KeepAlive> and <StartCalendarInterval> in a way that do look correct to me. But maybe I am wrong. Here is what I entered in the file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.lanceloz.backupfile </string>
<key>Program</key>
<string>/Users/lanceloz/Documents/BackupScripts/backupfile.sh</string>
<key>KeepAlive</key>
<true/>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>03</integer>
<key>Minute</key>
<integer>00</integer>
</dict>
</dict>
</plist>
Am I missing something obvious? What should I change to have this daemon/plist loaded automatically as soon as my mac has finished booting.
thanks for your help.
Lance
I am trying to have a daily backup job run through launchd at 3:00am and I cannot seem to have a daemon with my script loaded automatically at boot time.
The script (backup.sh) works fine when I execute it directly and manually.
I have created a property list file which I stored in /Library/LaunchDaemons. The file is named "com.lanceloz.backupfile.plist" which is owned by root and has the -rw-r--r-- ownership.
My problem is that this plist is not automatically loaded at boot time. My understanding was that plists stored in /Library/LaunchDaemons would have to be loaded automatically at boot. But it does not appear to be so.
At boot, when I check what is loaded with "launchctl list", it does not appear in the list. But if i load it manually with "lauchctl load com.lanceloz.backupfile.plist", it works and appear in the list of active daemons.
As far as the content of the file, where I am using <KeepAlive> and <StartCalendarInterval> in a way that do look correct to me. But maybe I am wrong. Here is what I entered in the file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.lanceloz.backupfile </string>
<key>Program</key>
<string>/Users/lanceloz/Documents/BackupScripts/backupfile.sh</string>
<key>KeepAlive</key>
<true/>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>03</integer>
<key>Minute</key>
<integer>00</integer>
</dict>
</dict>
</plist>
Am I missing something obvious? What should I change to have this daemon/plist loaded automatically as soon as my mac has finished booting.
thanks for your help.
Lance