|
||||||
| Forums FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| ARCHIVES - Desktop Environments KDE, GNOME, FVWM, etc.. all those window manager related questions get in here. |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hello guys,
Could someone help me to write a simple backup script that backs up all /home directories with this conditions? 1. Script has to use tar command to backup the data 2. On Fridays backup should perform FULL backup 3. On Monday though Thursday the script has to perform differential backup (copy only data that have changed since last backup) 4. The script has to find out on which day of the week it is called and has to perform corresponding backup from the reference file in /var/log/backup/last-full-backup. This file needs to be updated each time after a full backup 5. For simplicity, backups should be created in this format: Full backup /tmp/backup-full-YYYY-MM-DD.tar Differential backup: /tmp/backup-diff-YYYY-MM-DD.tar 6. Log the names of all file saved during the backup to /var/log/backup/backup-YYYY-MM-DD.log 7. If backup didn't work email should be sent to Code:
admin@myserver.com Any help appreciated, Thanks Last edited by caf4926; 01-Jun-2009 at 02:42. Reason: remove email link |
|
|||
|
Hope you don't want someone to do it for you
that's not learning.So to get you started date +%A will give you the day, you can set up a cron job for admin, you'll very likely need to give admin su rights for the script. admin doesn't need a home, errors on cron job will be mailed to admin@cronhost any way. man tar will give you the syntax to keep permissions and stamps etc.. man date will give you the formats to use. If you wish to get admin's mail outside the box will take a fair few tricks I suspect mailserver being the key word. I do have pop access to mine when it is running which is rarely. Now that you have something tangible to start you with. If people see examples and where you're stuck they may be more inclined to help. so pseudo code if date +%A = friday name = diff-`date format` tar blahblah $name echo $name >> this/file.log else name = backup-`date format` tar blahblah $name cp $name /var/log/backup/last-full-backup echo $name >> this/file.log then you run as admin cron job if it errors it will send it to admin@cronhost More complicated subject header, need to find a way to send out the mail and error trap. Edit fixed pseudo code slightly. The above would work fine if the server could have user admins cronjobs running. If not then as said seems it would be error trapping and finding out how to send an email. As by default roots cronjob errors will be sent there but you can > /file_you_own 2>&1 |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|