Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A script to backup some key hidden system fiiles UNIX
Here a little shell script I wrote for easily switching from one Mac to another, or from one system to a new one. Sure, it is possible to use Carbon Copy Cloner or Apple's Software Restore, but these tools will copy all the stuff from one machine to another ... and sometimes, it is good to start with a clean state.

So you have to copy the data in /Users, but there are some other little configuration files that take a long time to customize. So here is a script to handle those items. What does it do? A folder is created, named with the current date. The Apache configuration files, the FTP files, the SystemConfiguration files, and the the crontab are copied to this folder.

How to launch it? Open Terminal, and type sh /path/of/the/script. Make sure you've made it executable first (chmod 755 script_name from within the script's directory).
#!/bin/sh
#	Allow switching from one mac to another
#	v0.1
#	g.durr.removethis@free.fr
#
cd "`dirname "$0"`"
mpath=`date`
mkdir "$mpath"
cd "$mpath"

#---------- APACHE ----------
mkdir http
cp /etc/httpd/httpd.conf ./http
cp /etc/httpd/mime.types ./http
cp -R /etc/httpd/users ./http

#---------- GENERAL ----------

cp -R /Library/Preferences/SystemConfiguration .
cp /etc/ftpusers .
cp /etc/hostconfig .

echo $PATH > ./PATH

#---------- CRONTAB ----------

mkdir crontab
cp -R /etc/crontab ./crontab/
crontab -l > ./crontab/`whoami`

#---------- INFO STARTUPITEM ----------
ls -lisa /Library/StartupItems/ > ./Info_startupitem
Let me know if anybody wants to improve it. It would be great if it was as complete as possible.

[robg adds: This is clearly not a complete backup script. However, it does do a nice job of copying over some of the "hidden" items one might miss in a system upgrade.]



October 26 2004 Update:
The author has sent in a much-revised version of the script. Due to the length of the script, I have uploaded it in a separate text file: bk_hidden.txt. Just copy and paste that into a new file in your fave Unix text editor, then follow the above directions to make it work.
    •    
  • Currently 3.33 / 5
  You rated: 4 / 5 (3 votes cast)
 
[7,686 views]  

A script to backup some key hidden system fiiles | 5 comments | Create New Account
Click here to return to the 'A script to backup some key hidden system fiiles' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Ideas for improving...
Authored by: the_webmaestro on Jun 22, '04 01:37:11PM

I guess one way to 'improve' is to enable cp'ing to their respective places on the new volume. I'm not completely certain of the ramifications... but think it would also be nice to grab the NetInfo stuff... (would that even be an option?)

---
Father of Jeremy Logan Leeds



[ Reply to This | # ]
A script to backup some key hidden system fiiles
Authored by: MtnBiker on Jun 22, '04 04:50:48PM

Thanks. I could have used this a few versions ago as I seemed to be creating new startup drives and losing track of these critical files. Nonetheless I will run it regularly to have a good back-up. To that end one suggestion would be to add to the name of the folder something like "Critical System Files Backup" to the date. Or maybe a folder of the suggested name and dated folders (such as is created now) within that folder.

Helpful now as I've been happy with my set-up lately and had kind of forgotten about these files, so it's could to be reminded of them and where to access them. For example, I knew I needed to update some of my Rendezvous "links" and it's handy to have a back-up.

---
Hermosa Beach, CA USA



[ Reply to This | # ]
A script to backup some key hidden system fiiles
Authored by: gancho on Jun 22, '04 10:20:12PM
Please consider using 'rsync' to back up your files. It will let you back up your files. I use a script like the below. Just add directories to the "for i in" line.
DIR=/Volumes/External Disk/Backup/
for i in /Applications /Users /Library
do
  echo "Rsyncing $i"
  rsync -Cavz "$i" "$DIR" > "$DIR/$i.out" 2> "$DIR/$i.err"
done


[ Reply to This | # ]
A script to backup some key hidden system fiiles
Authored by: sjk on Jun 23, '04 01:11:11AM
Bye-bye resource forks and metadata using the default rsync command. Try RsyncX instead.

[ Reply to This | # ]
A script to backup some key hidden system fiiles
Authored by: tripnz on Sep 23, '04 01:10:16AM

I have been using retrospect to back up a 120GB server. Because of the difficulties with retrospect I have been forced to look for alternatives. I recently discovered "crontab"ing, but I need to tar my dumps to a SCSI tape drive. I am using 2 types of drives, Sun DLT drive and SCSI VXA drive. Any idea where I can find the CMD to locate a tape drive? MT and RMT don't seem to be helping.

Any help would be greatly appreciated.

macTrip



[ Reply to This | # ]