LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Backup Script (https://www.linuxquestions.org/questions/linux-general-1/backup-script-139520/)

imsajjadali 01-28-2004 04:19 AM

Backup Script
 
can any body provide me the backup script on hard drive or tap.

Thanks in advance

chrisk5527 01-28-2004 06:48 AM

Just do something like:

Sunday
/sbin/dump -0f -u /dev/hda1 /dev/tape

Monday
/sbin/dump -9f -u /dev/hda1 /dev/tape

Tuesday
/sbin/dump -8f -u /dev/hda1 /dev/tape

Wednesday
/sbin/dump -7f -u /dev/hda1 /dev/tape

Thursday
/sbin/dump -6f -u /dev/hda1 /dev/tape

Friday
/sbin/dump -5f -u /dev/hda1 /dev/tape

Saturday
/sbin/dump -4f -u /dev/hda1 /dev/tape


Good Luck man.

imsajjadali 01-28-2004 07:12 AM

dear, your script does not solve the problem. I want to automate backup of my /home directory on to tap drive at 23:00 hours. Please give the complete script and changes required in crontab....thanks

chrisk5527 01-28-2004 07:30 AM

That script does do it, figure it out for yourself. I'm done here

chrisk5527 01-28-2004 07:30 AM

And whats a "tap" drive?

imsajjadali 01-28-2004 07:33 AM

Tap drive normaly used in all os for backup..same as cd rom

chrisk5527 01-28-2004 07:40 AM

Dont you mean a tape drive?

Well my script will work above.

You need to type "df" at the command line (without the double quotes) to figure out what partition /home is on. Lets say its on /dev/hda1. Then what you would do is edit your crontab (crontab -e) for
00 23 * * * /pathofscript/backupscript

Then in the backupscript you'll want
/sbin/dump -0u -f /dev/hda1 /dev/tape

homey 01-28-2004 03:30 PM

Here is an example of making backups to a second hard drive. You can change that to use a tape drive also.
You can change the names to meet your needs... :)

mkdir -p /mnt/backup
mount /dev/hdb1 /mnt/backup -t ext3


Edit the /etc/fstab to mount that directory every time you reboot
/dev/hdb1 /mnt/backup ext3 defaults 0 0

Make a text file called backup.job with these lines in it.
#!/bin/bash
filename=`date '+%m%d%y'`
tar -cvzf /mnt/backup/${filename}.tar.gz /home


Make the file executable with the command:chmod +x backup.job
Put the file into the /mnt/backup directory so you know where to look for it.

type the following commands:
export EDITOR=vi
crontab /etc/crontab
crontab -e


That will open up your personal crontab which you can edit to include your job....
Press the Insert key
Go to the next free line and add your backup job....
00 23 * * * /mnt/backup/backup.job


To save the changes....
Press the Esc key
Type :wq!


Now you should have a backup job ready to go.


All times are GMT -5. The time now is 08:41 AM.