different backups for primary and secondary
[scripts/scripts.git] / fai_backup.sh
index 314f053..d2ddb38 100755 (executable)
@@ -4,7 +4,7 @@
 configcp()     {
        file=$1
        mkdir -p $configdir/$file
-       cp -v $file $configdir/$file/$myip
+       rsync -av $file $configdir/$file/$myip
 }
 backupcp()     {
        cat=$1
@@ -30,7 +30,11 @@ backupdir="/mnt/tmp2"
 
 # initializing custom variables
 host=`hostname`
-myip="`host $host | awk '{ print $4 }'`"
+if [ -z $1 ] ; then
+       myip="`host $host | awk '{ print $4 }'`"
+else
+       myip=$1
+fi
 res=$?
 if [ "$res" != "0" ] ; then
        echo "unable to determine the hosts ip address"
@@ -64,8 +68,8 @@ else
 fi
 
 # config:
-for configfile in /usr/src/kernel/*config; do
-       configcp $configfile
+for configfile in /usr/src/linux/.config; do
+       [ -f $configfile ] && configcp $configfile
 done
 for onefile in profile network kernel wireless; do
        configfile="/etc/conf/$onefile"
@@ -82,7 +86,8 @@ done
 for i in dhcpd.conf fstab hosts host.conf hosts.allow hosts.deny lilo.conf \
                profile sendmail.cf resolv.conf exports fb.modes inetd.conf \
                xinetd.conf mp3user mp3db.conf modules.conf named.conf \
-               modprobe.devfs modprobe.conf crontab ethers HOSTNAME; do
+               modprobe.devfs modprobe.conf crontab ethers HOSTNAME \
+               lircd.conf; do
        [ -f /etc/$i ] && configcp /etc/$i
 done
 for configfile in /var/named/*; do