Scripul de mai sus, modificat pentru copierea pe device USB (presupunand ca device-ul se monteaza automat pe /dev/tty0)
File:
backup_to_usb.sh
Code:
#!/bin/bash.
DATE=`/bin/date +%Y%m%d`
TIME=`/bin/date +%H`
HOSTNAME=`/bin/hostname`
cd /tmp
echo Creating archive file ....
sleep 2
tar zcf $DATE.$TIME.$HOSTNAME.tar.gz /var/etc.
echo Copy archive file to USB device ....
sleep 2
cp $DATE.$TIME.$HOSTNAME.tar.gz /dev/tty0.
echo Delete the archive file from HDD ....
sleep 2
rm `date +%Y%m%d`.`date +%H`.$HOSTNAME.tar.gz
Si fisierul README.TXT completat de la pasul 4:
CODE:
After you have edited and save the file you must chmod the file +x to make it executable.
# chmod +x /etc/backup/backup_to_usb.sh
Step 5:
To run the backup script automatically you need to add a line to crontab.
# crontab -e
To run daily enter the line
* 0 * * /etc/backup/backup_to_usb.sh
To run weekly on Sunday @00:00hr enter the line:
0 0 * * 0 /etc/backup/backup_to_usb.sh
To run monthly on the first day of the month @00:00hr enter the line:
0 0 1 * * /etc/backup/backup_to_usb.sh


Thanks:
Likes:
Dislikes:
Reply With Quote