Applescript and Filemaker Server 7
Here's something very unusual we recently noticed about Filemaker Server 7 at my day job. If you use its built in Scheduler to schedule backups, it will only let you send a backup to the same disk that Server resides on (previous version of Filemaker Server did not have this limitation). Since that's also where the databases themselves live, backing up to that drive is kind of silly. With your live files and your backed up files on the same drive, you instantly lose both if that drive dies. See? Silly.
So, we cooked up a quick and dirty folder action Applescript solution to force the files onto an external firewire drive. Check out the script after the jump.
property dialog_timeout : 30
on adding folder items to this_folder after receiving added_items
try
tell application "Finder"
get weekday of (get current date) as string
set Today to result
if Today = "Monday" then
move added_items to folder "mon" of disk "BACKUP" replacing yes
else if Today = "Tuesday" then
move added_items to folder "tue" of disk "BACKUP" replacing yes
else if Today = "Wednesday" then
move added_items to folder "wed" of disk "BACKUP" replacing yes
else if Today = "Thursday" then
move added_items to folder "thur" of disk "BACKUP" replacing yes
else if Today = "Friday" then
move added_items to folder "fri" of disk "BACKUP" replacing yes
end if
end tell
end try
end adding folder items to
This is attached as a folder action script to the backup folder on the Filemaker Server, and it's run whenever that folder is updated (which happens every night at 12:00 AM
when Filemaker Server performs its scheduled backup). When the backup is complete, the Applescript first notices that that folder has been altered. This calls it into action. First, it checks to see what day of the week it is, and then moves the contained files to a folder of the same name on an external drive. So, if today is Monday, the backed up files will be moved to the "mon" folder on the external drive, and so on with the rest of the weekdays. On the following Monday, it starts again by overwriting the files already in the Monday folder (we only keep a week's worth of database backups around).
Now, I know there are more elegant ways to get this same routine done. I'm hardly a seasoned Applescripter. But this worked, so I thought I'd pass it on. I
hope you found something useful here.
Incidentally, this same script has prompted me to devise a way to keep my desktop clean. I've attached it to a folder on my desktop I've labeled "to_dropbox." Anything dropped into that folder is moved, via the same daily routine, to a folder called "dropbox" on my external hard drive. At the end of the week, I can go through there and weed out what I want to keep, and what I want to trash. Plus, if I want to go back to a "Tuesday" version of a given file, I have it. Finally, it keeps the clutter off of my desktop.