Backups on OS X

| categories: mac, linux | View Comments

Back to backing up (no pun intended), OS X uses a launchd system rather than "cron.daily". If you are like me, you probably don't want to know why and you don't care. You just want a cron.daily approach, and a way to know whether it worked or not.

So put your bash script from here somewhere on your system, and put the following script in your ~/Library/LaunchAgents/ , with a name like me.bckup.daily.plist (though the name should not matter, or so they tell) :

 1: <?xml version="1.0" encoding="UTF-8"?>
 2: <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/
 3: DTDs/PropertyList-1.0.dtd">
 4: <plist version="1.0">
 5: <dict>
 6: <key>Label</key>
 7: <string>me.bckup.daily</string>
 8: <key>LowPriorityIO</key>
 9: <true/>
10: <key>Nice</key>
11: <integer>12</integer>
12: <key>Program</key>
13: <string>/path/to/your/script/bckup_to_hd</string>
14: <key>StartCalendarInterval</key>
15: <dict>
16: <key>Hour</key>
17: <integer>16</integer>
18: <key>Minute</key>
19: <integer>49</integer>
20: </dict>
21: <key>StandardErrorPath</key>
22: <string>/path/to/log_err_file.txt</string>
23: <key>StandardOutPath</key>
24: <string>/path/to/log_out_file.txt</string>
25: </dict>
26: </plist>

with the obvious ammendments of the exact time you want it to be launched every day, and your exact absolute paths.

To begin its action for the first time, either logout and login or :

1: launchctl load me.bckup.daily.plist

If something went wrong, you could use launchctl unload instead of load , get things straight and load again.

Now, how do you know if something went wrong ?

first, you have your log files /path/to/log_*_file.txt . Second, you could search for clues in /private/var/log/system.log in the time you designated.

Copyright (C) 2015 by Avi Gozolchiani. See the License for information about copying.

org-mode source

blog comments powered by Disqus