I'm looking to automate a backup process that involves transporting backup files (with names in the form "*.savf") first onto a Mac Mini (running Yosemite), and then, once they're on the Mini, moving them from where they were initially placed onto external USB drives. This is a process that was formerly running on a very large, very noisy, and very worn-out Linux box.
So far, I have the files arriving on the Mini. But can anybody point me towards an easy way to automate moving them to the external drives?
You want details, here they are:
The two external boxes being backed up (AS/400s, hence the "SAVF" extensions), either every evening at a specified time, or when they are told to shut themselves down, will run a program that checks specified libraries to see if there is anything in them that needs backing up. If a library needs backing up, it will be saved to an AS/400-specific construct called a "save file," and then FTP'd to the backup server (each has its own account on the backup server, with its own home directory).
On the Linux backup server, because I could not work out a way for it to FTP directly to the external drives, there was a shell script, running as a cron job, under root authority, which copied those save files to the external drives, then deleted them from the home directories.
I have the first part working very nicely on the Mac. Not sure how to make the second part work.
5/8/2023: I've just successfully reverse-engineered my own shell script:
#!
cd /Users/foo
cp *.savf /Volumes/BACKUP/foo
mv *.savf /Volumes/BACKUP2/foo
cd /Users/bar
cp *.savf /Volumes/BACKUP/bar
mv *.savf /Volumes/BACKUP2/bar
Now, to make it execute at a specific time of day, under root authority, and ignore all errors . . .
**** May 10th ****
I now have a plist in /Library/LaunchDaemons (put in late yesterday afternoon), BUT IT DIDN'T WORK! It's called "sweep.plist," and it is as follows:
<?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>sweep</string>
<key>Program</key>
<string>/Users/europa/sweep.sh</string>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>8</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
</dict>
</plist>
And I did a launchctl load /Library/LaunchDaemons/sweep.plist
(either sudo'd or in a sudo bash) once it was in place. I'm absolutely certain that after I did so yesterday, "sweep" showed up in a launchctl list
, but it didn't execute, and it no longer shows up when I do a launchctl list
.
Any idea where to look for the problem?
New: I just checked the system log, and found this: May 10 08:00:05 Europas-Mac-mini com.apple.xpc.launchd[1] (sweep[1299]): Program specified by service is not a Mach-O executable file.
Looking at the shell script with a ls -l
, it shows permissions as -rwxr-xr-x@
tmutil startbackup
will then, well, start a backup. Find a way to schedule thetmutil
command, and Bob's your Uncle.