Okay after a bit of thought I've produced these notes - I now get the errors you can see in red.
Process for producing a script to copy files and then automate the process.
Example command line to do the backup:
rsync -aE --delete "/Users/daronbrewood/Library/Mobile Documents/com~apple~CloudDocs/Keys" "/Users/daronbrewood/OneDrive/Mac Mini Backup/"
This should then be turned into a script file such as:
#!/bin/bash
rsync -aE --delete "/Users/daronbrewood/Library/Mobile Documents/com~apple~CloudDocs/Keys" "/Users/daronbrewood/OneDrive/Mac Mini Backup/"
and saved in:
/usr/local/bin
e.g.
/usr/local/bin/backupkeyfiles.sh
Once the script has been created it then needs to be run on a schedule:
This will be done via a demon, and the following will run every 2 hours (7200 seconds)
<?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>BackupKeyFiles</key>
<string>local.restart</string>
<key>Program</key>
<string>/usr/local/bin/backupkeyfiles.sh</string>
<key>StartInterval</key>
<integer>7200</integer>
<true/>
</dict>
The demon file is to be named ‘com.daron.back-up-key-files.plist’ and saved into ‘~/Library/LaunchAgents/’ as that position will allow the script to run when only myself is logged on.
Note ~ indicates home directory.
(Reference:
https://stackoverflow.com/questions/132955/how-do-i-set-a-task-to-run-every-so-often)
Set the permissions on both files in Terminal:
chmod +x backupkeyfiles.sh
chmod +x com.daron.back-up-key-files.plist
To start the daemon running execute the terminal app and run:
launchctl load ~/Library/LaunchAgents/ com.daron.back-up-key-files
Problems on looking to start the demon I get:
daronbrewood@Darons-Mini-54 LaunchAgents % launchctl load ~/Library/LaunchAgents/ com.daron.back-up-key-files
/Users/daronbrewood/Library/LaunchAgents/com.hp.devicemonitor.plist: service already loaded
/Users/daronbrewood/Library/LaunchAgents/com.daron.back-up-key-files.plist: Invalid property list
/Users/daronbrewood/Library/LaunchAgents/com.microsoft.OneDriveMigrationLauncher.plist: Service is disabled
/Users/daronbrewood/Library/LaunchAgents/com.dropbox.DropboxMacUpdate.agent.plist: service already loaded
/Users/daronbrewood/Library/LaunchAgents/com.daron.back-up-key-files: Not a directory
/Users/daronbrewood/Library/LaunchAgents/com.macpaw.CleanMyMac4.Updater.plist: service already loaded
daronbrewood@Darons-Mini-54 LaunchAgents %
Again any assistance appreciated.