Fairly complicated, but there must be a way.

twyg

Back to Mac Baby!
Ok, here's the situation.

I have 10 macs in a LAN setting. 7 of those macs are running 10.1.
One machine acts as the "server" where AppleTalk is turned on, and everyone drops their files there. The current situation requires me to go once a week from mac to mac with a Firewire CD-R drive, and go through what the user wants backed up. Usually to expedite the process I just do a sherlock find file on files that have been modified in the past week through VNC. I also have remote login turned on for those machines running X. (For troubleshooting from my cubicle on stupid stuff like "I can't delete my trash because it says it's in use!?")

Ok, so here's what I want. I want on Friday night for my machine to "run" from computer to computer on the network, pull the data modified in the past week to the "server" excepting files larger than say 50MB, tar and gzip all newly modified files from all machines into their own respective folders, and take all the folders and burn them to a CD I've already prepped for the purpose. *whew*

Normally I would buy Timbuktu or a like program, however I work for a non-profit which means $1 or $2 a month spending allowance for the tech department. ;)

I know that cron jobs have a lot to do with this type of task, and I certainly will be more than happy to get a number of answers, and string it together myself. i.e. you know how to do the remote login, and copying with cron, but not how to find a file modified in the past week that is under 50MB. No sweat, I just would like to get something in place to resolve this issue sooner rather than later.

Thanks, and whoever solves this one for me I owe a brewski. (or a soda should the circumstances require it):D

(just realized this is in the wrong forum, sorry jdog!)
 
But here are a couple of things to consider.

tar drops resource forks. This is quite likely not what you want. There is a program out there called hfspax that I guess basically functions like pax (a poor cousin to tar, I gather), except that it respects resource forks and finder flags.

You could use a cron job on each computer mount (see man mount, obviously) the afp server disk, then use hfspax to make a new pax.gz file of each user's home directory on the server. For the format of the crontab file, try 'sudo crontab -e' which will start up your default editor to edit root's crontab.

For checking the size and age of files, try the man page for test - you can do at least things like (using /bin/sh syntax):

if [ file1 -ot file2 ]
then
stuff to do if file1 is older than file2
fi

Do you really need to burn the backups if the files are already on the server? If so, try hdiutil, it has some options for CD burning.

Sorry no full answers to any of this, but hopefully some of this will be useful to you.
 
To find the files you're looking for, this find command should do the trick:

Code:
find / \( \! -fstype local -or -fstype fdesc -or -fstype kernfs \) -and -prune -or \( -type f -and -mtime -7 -and -size -50000000c -and -print \)

It only runs against local filesystems, looks for only files modified in the last seven days, and less than 50,000,000 bytes in size. If you don't want to do it against the entire system, change the / to the point you're interested in (like /Users).
 
No apologies necessary, this is getting me on the right track.

So, before I destroy all hopes of doing this nicely, let me show you how I've interpreted the info I've recieved.

For a cron job I'll go sudo crontab -e
I've got a hang up here, as I don't know jack didley about Cron coding. So where is a good place to get info?

blb, Rockin! That code does the precise look-up job I wanted. I don't mind picking up all the .plist info, nor the .DS_store so it works great as is.

This now steps back to the crontab edit. How do I tell the job to take the search results, and pull them into a tar? (or pax file for that matter, but I don't mind the resource fork problem.)

This is kind of a quick and dirty, and if it doesn't show off the power of OS X I don't know what does. This will look very favorable to the PC people on the board who can't understand for the life of them why we use Macs as full blown business machines. (Or how.)

I really appreciate the depth of the answers, thank you! (Note the lack of the sarcastic smiley, I do genuinely mean that ;) )

** Update - I've found a good tutorial on cron, but am still looking for assistance from the experienced folks :) I'm not a lazy kinda guy, but sure, I'll take a magic bullet.
 
The largest problem I see is spaces; specifically spaces in all those filenames. On a non-space-using Unix, you could do something like

Code:
tar cf backup.tar `find ... -print`

(the find obviously being chopped down). This works nicely as the output from find is a simple list of files. But as soon as one of those files has a space, that file won't be picked up (as it is taken as two files). Maybe some kind of perl-based wrapper is needed for this part?
 
Another thing to think about is the file permissions. By default you won't be able to read other users' Home folders, but you might be able to make 'backup' group or something that gives you access.

You can also use ssh and scp to access the files on other users' drives (with the permissions issue settled). You could run a script on each computer remotely (with ssh) that runs hfspax locally and then scp's it back to your server where your server can do what it likes with them.

Just a thought...

You might also look into some of the traditional unix backup tools like Amanda (http://www.amanda.org), but I don't know if you can make them work with hfspax, and it might be fairly complicated for someone to learn quickly.

-Rob
 
In a unix world there exists a tool called rsync. rsync keep file systems in sync across ssh connections. You can use it to take files modified from a specific date. Good stuff check it out. a simple cron job running once a night you can do a backup with the minimum of effort. (i.e sticking a CD in the drive and draging a file to the CD and burning it)
 
The above mentioned space problem might not actually be one. The man page for pax (I don't have hfspax installed to check) seems to indicate it can handle that:

-w Write files to the standard output in the specified archive format. When no file operands are specified, standard input is read for a list of pathnames with one per line without any leading or trailing <blanks>.

so you could maybe just pipe the find command's output to hfspax.

That said, looking at the man page for rsync, it seems designed to do just what you are describing. Might just be the way to go. The only problem might be how to get all the backups down to one CD-R size.

Would RAID be out of the question? OS X has (minimal) RAID support - enough for mirroring, so that if you could scrounge a couple extra HDs for your AFP server's shared directory, you could effectively immunize yourself from drive crashes. I understand you are on a tight budget and all...
 
Well, apparently it took a month for me to come up with the answer...

RAID is unfortunately out of the question. It simply costs too much. I have started to pan through the man pages on rsync, and I thank all for the input. I'm sure I will be back with input soon. ;)
 
Back
Top