here's a simple shell script that i wrote to backup certain files and
directories, and to ftp them to another host for safe keeping, as well as
keeping a local copy. make sure you have a .netrc file in the /root
directory with the login info so that the script can automatically login and
transfer the files. it's not much, but it's better than loosing your home
directory.
the backup.sh script is as follows:
#!/bin/sh
DATE=`/bin/date +%d-%b-%Y`
echo "~~~BEGINNING BACKUP OF YOUR.DOMAIN.COM~~~"
echo "===> COMPRESSING FILES AND FOLDERS"
tar -cpszf httpd.bak.tar.gz /home/httpd
tar -cpszf httpdconf.bak.tar.gz /etc/httpd
tar -cpszf named.bak.tar.gz /var/named
tar -cpszf mailconf.bak.tar.gz /etc/mail
tar -cpszf firewall.bak.tar.gz /etc/rc.d/rc.firewall
tar -cpszf mailspool.bak.tar.gz /var/spool/mail
tar -cpszf sendmailcf.bak.tar.gz /etc/sendmail.cf
echo "=====> CREATING DIRECTORY"
mkdir /home/backups/ns1_$DATE
echo "=======> MOVING FILES AND FOLDERS TO DIRECTORY"
mv -f *.bak.tar.gz /home/backups/ns1_$DATE
echo "=========> COMPRESSING DIRECTORY"
tar -cpszf ns1_$DATE.tar.gz /home/backups/ns1_$DATE
echo "===========> SENDING DIRECTORY TO BACKUP SERVER"
ftp <<**
open YOUR.FTPHOST.COM
bin
put ns1_$DATE.tar.gz /backups/ns1_$DATE.tar.gz
bye
**
echo "=============>REMOVING COMPRESSED DIRECTORY"
rm ns1_$DATE.tar.gz
echo "~~~BACKUP COMPLETE~~~"
and the format of the .netrc is as follows:
machine YOUR.FTPHOST.COM
login USERNAME
password PASS
> > As for the original posting, that's the eternal danger of rm -R.
> > But you should be able to concoct a simple script that
> > intercepts the -R and makes you think twice about it. Come to
> > think of it, why don't I do that myself ?? :^\
> On a filesystem separate from /home:
> tar cpvf - /home/* | gzip -c > home.tar.gz
> A good idea would be to do a weekly or daily backup, include the date in
> the name of the tar file, and burn it onto a CD or copy to tape. In
> case something happens, you'll be able to pick from a range of dates.
> For example:
> home-Wed Jan 17 02:53:03 EST 2001.tar.gz
> tar cpvf - /home/* | gzip -c > "home-`date`.tar.gz"
> Of course, you might want to format the args to the date command. But,
> I don't see the problem in keeping the spaces in there from the date
> command. It just looks like something 'Doze would do, that's all. ;)
> -Donn
> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----== Over 80,000 Newsgroups - 16 Different Servers! =-----