auto-mount network drives and back up

Posted by: macDeviant

auto-mount network drives and back up - 09/22/06 06:56 PM

okay i have my beige g3 and i want to use it as a server to back up my 5 other running machines at least weekly.

does anyone know of applescripts, freeware, not-so-freeware, or anything else that would allow me to mount specific volumes from each machine back them up then dismount the volumes all at a scheduled time? i've been looking and might have found something. but just wondering if anyone has foudn anything that would suite this very purpose...

i want to set up an auto-backup-server cause as much as i try i never remember to back up my hard drives.

smile i don't ask for much

macDeviant
Posted by: krusher117

Re: auto-mount network drives and back up - 09/22/06 07:43 PM

i auto mount my free 1GB smile



Ive attached the script.....look DOWN BELOW
Posted by: krusher117

Re: auto-mount network drives and back up - 09/22/06 11:04 PM

i know that doesn't help your predicament....lol
Posted by: macDeviant

Re: auto-mount network drives and back up - 09/23/06 12:42 AM

Originally Posted By: "krusher117 "

i know that doesn't help your predicament....lol


i apprciate the effort  smile ;D lol thanks
Posted by: Waragainstsleep

Re: auto-mount network drives and back up - 09/23/06 08:05 AM

You wouldn't have to become a scripting genius to do this.
You can use cron to run your script at the desired times, or simply run it as a login script Though this may slow the machine down for a little bit while you are trying to use it.

You can drop afp servers into your list of login items, then your script would only need to run a cp terminal command or two to copy the required folders onto the network volume. You might be able to do it with automator. Then you can use cron to schedule the backups, or you could attach a shutdown command on the end of the script, then when you feel inclined, finish using the machine, run the script and it will back itself up and shut itself down.

Don't try too hard on this, a family pack of Leopard will do this for you much better with Time Machine. And the server wouldn't need to be running Leopard in order to do it either.
Posted by: soundmann18

Re: auto-mount network drives and back up - 09/23/06 09:20 AM

I don't really know anything about writing scripts, but if you make the part that tells the computer to back itself up, you can set iCal events to run scripts, so you'd just make the event, tell it to run the script and repeat it however often you want.

War- do you know if you could use a non-apple box for the backup with time machine?  I've got an old P2 that i'm going to set up sometime soon for server-ing
Posted by: macDeviant

Re: auto-mount network drives and back up - 09/23/06 09:22 AM

well since it's a beige G3 i don't think i'll have to worry too much about trying to run leopard on it :)  admittedly this will be the first time to set up a server (also the first time i have had an extra computer to suit the purpose) what is "cron"? and i guess i should start looking up some commandline scripts/promts/commands (since i haven't used that much either)

thanks
Posted by: Waragainstsleep

Re: auto-mount network drives and back up - 09/23/06 04:00 PM

When you setup Time Machine, it asks you to choose backup destination. You don't seem to be able to drag your boot drive into the list, but afp servers show up automatically. My bet is if the Finder can mount it and write to it, Time Machine can use it.

cron is a system tool which runs 'maintenance' scripts at scheduled times. It can be modified to include extra scripts and to change the times it runs. There is a shareware app which provides a GUI front end to it, I forget what its called.

If you want to learn the terminal or scripting, I would search over on the oreilly network. They print many Mac textbooks and have alot of useful stuff on their site. The Jaguar based terminal tutorial is still close enough to be of use in Tiger.

the 'man' command can be used with another command as its argument to display the maual for that command. This tells you what it does and how it should be used. Open Terminal and type: "man cd"
This will display the manual for the cd or change directory command. press q to get out of a manual page.
Posted by: zenstate

Re: auto-mount network drives and back up - 09/24/06 12:10 PM

i'm pretty sure apple has pre-written scripts that do this on their site.
Posted by: Anonymous

Re: auto-mount network drives and back up - 10/15/06 04:41 PM

What are you looking to back up, the entire system, users folders, applications folders, shared folders?  Depending on how hard core you want to get the paid for Retropect Server can do it for you, but it cost money.  Let me know what you have found and I will suggest others.  The other possibility is  to try doing it with something like carbon copy cloner (shareware I think, but well worth it).

There are other options out there, but it all depends on how much you want to backup.  If I were looking to do the cheapest way it would be the free way of partitioning out the biege hard drives (uh.. how are you doing that by the way, connected firewire drive? or PCI SATA card?).  Once partitioned you could write a simple applescript or shell script to mount drives and DITTO the files (don't cp the files, doesn't always take the resource forks).

Let me know more of what you want and I'll share what scripting knowledge I can with you.

Chris
Posted by: mordaskyt

Re: auto-mount network drives and back up - 10/15/06 05:11 PM

Some time ago I reviewed iBackup, though I cant seem to find the review on MacMod anymore. At any rate its a simple free utility that does exactly what you are asking. You schedual times and what you want to back up for each client and iBackup does its thing. It mounts the desired volume, performs the backup and unmounts when its finished.

http://www.grapefruit.ch/iBackup/index.html
Posted by: macDeviant

Re: auto-mount network drives and back up - 10/16/06 10:26 AM

I'm just looking to back up the home folders for each user on the network a total of 5 computers plus the server it's self. i don't need to use carbon copy cloner, since i don't require a bootable drive. though at some point that might be a good idea.

like i said in my first post. i would like this to be completely automated. the server starts up at a certain time of the night. wakes Each computer then mounts the appropriate drive or folder. Copies the contents of the specific drives/shared folders to a specific place on one drive or a designated drive. After the back up of each machine is completed they should be put back to sleep.

yep not much......

macDeviant
Posted by: Waragainstsleep

Re: auto-mount network drives and back up - 10/17/06 12:12 PM

You might be able to do everything from the server.

You can wake the server at scheduled times easily enough from the sys prefs.
You can schedule a script to run using cron.
This script would need to contain lines to accomplish the following:

01 Wake the first client machine;
02 Mount the shared volume;
03 Copy the user folder to the server;
04 Sleep the client;
05 Repeat the first 4 for the other clients;
06 Sleep the server;

Lets address these one at a time (If I could write the script for you on the fly I would, but my scripting isn't that hot).

01 You could wake the client machines using sys prefs too, but you would need all machines to be consulting a network time server and/or some variation in waking times to allow for services and things to startup and you are going to end up with machines waiting for each other to finish backing up unless you do them all at once and either way, you are wasting electricity.
Better to use magic packets to wake the clients. I use an app called Wake Up! to do this from the Finder, not sure if it is scriptable or not but I would be very surprised if there is not a command line tool which can do this part for you. Should be able to put them to sleep again too.

02 It should be easy enough to mount the client. I imagine the Mount command will do it for you, you'll have to look up the exact syntax.

03 Copying is easy enough. the copy command in terminal is cp.

04 As mentioned, your magic packet tool should sort this part out for you.

05 You could try and be fancy and use some kind of loop, but since you only have 5 machines, you may as well make good use of copy and paste and just change the names of the clients and user folders as needed.

06 I imagine there is a simple command to do this, but I don't know what it is. I know there is one for shutting down.

I mentioned that some services will need time to start up. If you wake a client and immediately try to mount it over afp, you are risking timeouts. You can make the script pause using the sleep command. (Syntax is "sleep n" where 'n' is the number of seconds).

Doing things this way will require the clients to run AFP of course, and to sleep at all times instead of shutting down, but to be honest only the RAM is powered during sleep and that runs on 2 or 3 V, so its not so bad.

The only problem I can see doing things this way, is that when you copy a user folder from a client over AFP, you tend to get permissions issues. That should be the trickiest bit.

macosxhints and the o'reilly website are good sources for learning about terminal commands. If you know the name of a command you can read its instructions using the 'man' command. ("man command") where command is any terminal command will display the manual pages. If youa re looking for a command, you can search for keywords using the 'apropos' command, followed by a keyword to look for. This will show a list of commands which are relevant to that keyword.

You will find there are good scripters on the Apple Discussions boards if you want someone knowledgable to ask about things.
Posted by: Anonymous

Re: auto-mount network drives and back up - 10/19/06 08:14 PM

use "ditto" instead of "cp" for your command if you are going to use the shell for scripting.  Ditto takes all the fie forks so the files are actually usable when they are copied.

I'm not sure how you could tell a machine to "wake" unless you use the "wake for ethernet network administrator access".  I imagine that is based on the Remote Desktop port for the waking.  Hey here's an idea, I'd say it may be easier than anything else.  All times are fictitious, but you'll get the idea.  If you server goes to sleep, stop doing that. (Don't forget that your computer runs performance cron jobs while you are sleeping on a daily, weekly and monthly basis).  Then use this idea...

At 0300 have each machine make a disk image of the user's home folder.  Compress it.  Send it to the server, with the IP or user's name (if they are unique).  This would allow for all computers to be backing up at the same time and writing to the server at the same time.  I believe this is a reverse answer to your  problem, but appears to be one that could be scaled to any number of machines....

I'll try making a script for it, if I am successful, I will post it.


chris
Posted by: Anonymous

Re: auto-mount network drives and back up - 10/19/06 08:44 PM

So the auto-mount is fairly easy.  I'll let you figure that one out, it will be worth your time to figure it out and learn a little bit about applescript.  Here's a proof of concept script to show you that you can compress a folder to a zip file...  you could expand this to do a tar or some other form of compression, or do multiple folders to the same zip....


put this in script editor or copy the unix command to the terminal to test for yourself.  good luck, let me know if you need any help.

-- pick a file to zip (in your case you could just set POSIXFolder to "~/" if the user you want to backup is logged in or "/Users/" if you want to get them all.  But beware, some apps store some big files in the user library folders!
set FinderFolder to choose folder

-- this step is to make the finder file you just selected into a POSIX (unix) path.
set POSIXFolder to (POSIX path of FinderFolder)

-- here's the chicken and stuffing of the script.  First move to the directory to create the zip file in, then do a ditto to crate the file.  I named it Test.zip, but you could name it whatever you want (a different name for each script, or append this script to make that a variable of your choosing
set ArchiveScript to ("cd ~/ ; ditto -c -k -X --rsrc " & POSIXFolder & " Test.zip ")

-- And do the script.  This is just how I like to write scripts.  Define the script, then a separate command to run it.  I don't know how much more memory or time I am wasting doing it this way, but it makes it alot easier if you are going to be test multiple script values.  At least I think so.
do shell script ArchiveScript



Enjoy!


chris