On Mon, 2004-12-13 at 03:57 -0700, mike hoy wrote: > Hi, > > I'm running a webserver and decided to back it up using a crontab. > > But first I need a good shell script for crontab to execute. > > I created this shell script: > > Can someone look at this is give a bit of advice. > > #!/bin/bash > > echo "beginning to copy files..." > > cp -R * /mnt/DesktopBackup/website/ > > echo "done copying files..." > > I run this script from inside of my web directory. which is the source > of the backup. > > Question: is the -R what allows me to copy folders and their > subdirectories?? or is their a better way to do this? ---- it's the way I do it - there is rsync (man rsync) ---- > > I have lots of folders within folders within folders... it's a mess. ---- with shell scripts - you need to be really specific about things and not count on it to know which files/directories you are specifically referring to... cp -R /var/www/html/* /mnt/DesktopBackup/website fwiw - I will include some of my shell scripts for this purpose - I'm proud of some of them, lately, I've been able to get them done without asking for help from the list ;-) # cat /root/scripts/backup.weekly #!/bin/sh # separate - simple backup script to backup # weekly - primarily the configs but a # simple dump of ldap / dhcpd / named data # doesn't take much space, whereas the files # from netatalk and samba are massive # see companion file backup.mkdir to create the # directories for this backup backup=/home/storage/backup # LDAP service ldap stop /usr/sbin/slapcat -l $backup/ldap/data/data.ldif cp -fpvur /var/lib/ldap/* $backup/ldap/data cp -fpvur /etc/openldap/* $backup/ldap/config cp -fpvur /etc/openldap/ldap.conf $backup/ldap/config cp -fpvur /etc/pam.d/system-auth $backup/ldap/config cp -fpvur /etc/nsswitch.conf $backup/ldap/config service ldap start # BIND cp -fpvur /etc/named.conf $backup/named/config cp -fpvur /var/named/* $backup/named/data # DHCP cp -fvpur /etc/dhcpd.conf $backup/dhcpd/config cp -fvpur /var/lib/dhcp/* $backup/dhcpd/data # SAMBA (config only) cp -fvpur /etc/samba/* $backup/samba/config # Netatalk (config only) cp -fvpur /etc/netatalk/* $backup/netatalk/config # Sendmail (config only) cp -fvpur /etc/mail/* $backup/sendmail/config cp -fvpur /etc/aliases $backup/sendmail/config # WWW - the web tree cp -fvpur /etc/httpd $backup/html/config cp -fvpur /var/www/html/* $backup/html/data # # cat /root/scripts/backup.mkdir #!/bin/sh base=/home/storage/backup this[1]=ldap this[2]=named this[3]=dhcpd this[4]=samba this[5]=netatalk this[6]=sendmail this[7]=html for a in 1 2 3 4 5 6 7 do if [ ! -e "$base/${this[a]}" ] then mkdir $base/${this[a]}; mkdir $base/${this[a]}/config; \ mkdir $base/${this[a]}/data fi done YMMV Craig --------------------------------------------------- PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us To subscribe, unsubscribe, or to change you mail settings: http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss