LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   incremental backup (https://www.linuxquestions.org/questions/linux-software-2/incremental-backup-155869/)

reaky 03-10-2004 10:40 AM

incremental backup
 
hi all
i want to make a backup script to make incremental backup every day on the lastday backup.
can any one hlp me for that

jailbait 03-10-2004 10:56 AM

"i want to make a backup script to make incremental backup every day on the lastday backup.
can any one hlp me for that"

I use the cpbk in a cron job to do a daily incremental backup to a backup partition. Here is my script:

# This command saves fedora to a backup disk
# partition
# It only copies files that have changed.
# It removes backup files for which the source file has been deleted.

# If /backup does not exist then error touch and exit
if test ! -d /backup;
then
touch /root/data/backups/cpbk.failed.date
exit 1
fi

if test ! -d /backup/fedora;
then
mkdir /backup/fedora
fi

if test ! -d /backup/fedora/bin;
then
mkdir /backup/fedora/bin
fi
cpbk -q /bin /backup/fedora/bin

if test ! -d /backup/fedora/boot;
then
mkdir /backup/fedora/boot
fi
cpbk -q /boot /backup/fedora/boot

if test ! -d /backup/fedora/dev;
then
mkdir /backup/fedora/dev
fi
cpbk -q /dev /backup/fedora/dev

if test ! -d /backup/fedora/etc;
then
mkdir /backup/fedora/etc
fi
cpbk -q /etc /backup/fedora/etc

if test ! -d /backup/fedora/home;
then
mkdir /backup/fedora/home
fi
cpbk -q -c /root/data/cpbkrc/home.cpbkrc /home /backup/fedora/home

if test ! -d /backup/fedora/lib;
then
mkdir /backup/fedora/lib
fi
cpbk -q /lib /backup/fedora/lib

if test ! -d /backup/fedora/makeCD;
then
mkdir /backup/fedora/makeCD
fi

if test ! -d /backup/fedora/mnt;
then
mkdir /backup/fedora/mnt
fi

if test ! -d /backup/fedora/mnt/cdrom;
then
mkdir /backup/fedora/mnt/cdrom
fi

if test ! -d /backup/fedora/mnt/floppy;
then
mkdir /backup/fedora/mnt/floppy
fi

if test ! -d /backup/fedora/opt;
then
mkdir /backup/fedora/opt
fi
cpbk -q /opt /backup/fedora/opt

if test ! -d /backup/fedora/root;
then
mkdir /backup/fedora/root
fi
cpbk -q -c /root/data/cpbkrc/root.cpbkrc /root /backup/fedora/root

if test ! -d /backup/fedora/sbin;
then
mkdir /backup/fedora/sbin
fi
cpbk -q /sbin /backup/fedora/sbin

if test ! -d /backup/fedora/spare1;
then
mkdir /backup/fedora/spare1
fi

if test ! -d /backup/fedora/spare2;
then
mkdir /backup/fedora/spare2
fi

if test ! -d /backup/fedora/software;
then
mkdir /backup/fedora/software
fi

if test ! -d /backup/fedora/tmp;
then
mkdir /backup/fedora/tmp
fi
cpbk -q /tmp /backup/fedora/tmp

if test ! -d /backup/fedora/var;
then
mkdir /backup/fedora/var
fi
cpbk -q -c /root/data/cpbkrc/var.cpbkrc /var /backup/fedora/var

if test ! -d /backup/fedora/usr;
then
mkdir /backup/fedora/usr
fi
cpbk -q /usr /backup/fedora/usr

# Change cpbk date
touch /root/data/backups/cpbk.date


___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites

reaky 03-10-2004 11:21 AM

sory but can you show me how do you make it run daily
and what's the meaning of( test !-d )
thanks for help :)

jailbait 03-10-2004 03:02 PM

"what's the meaning of( test !-d )"

That statement checks to see if the directory exists, if not then create the directory.


"can you show me how do you make it run daily"

You put a line in /etc/crontab telling cron to run your script once a day.
See:
man crontab
man cron


---------------------
Steve Stites


All times are GMT -5. The time now is 06:12 PM.