Using Cron
Is there a way using cron i could backup the /var/named folder and /etc/named.conf file to a tar file but have it create a daily backup ie. named.monday.tar which would be overwritten the following week.
Sorry if its a bit vague.. |
I think this should be straight forward, yeh ? Write a shell script to do exactly what you want to do and insert an appropriate line into crontab file and cron should execute the shell script at the time you've configured it to. Am I sounding stupid here ?&*^*&^*&
|
to create a cronjob, type crontab -e and set it to run at the appropriate time:
* 6 * * * $HOME/script.sh >> $HOME/script.out 2>&1 This should run the script every minute for the 6 AM hour of everyday. The fields are minute, hour, day, month, day of week. See man crontab. The 2>&1 should output both errors and STDOUT. http://wiki.linuxquestions.org/wiki/Crontab http://bookmarks.linuxquestions.org/linux?like=cron |
To retrieve the name of the day, use something like:
Code:
today=`date +%A` or Code:
today=`date +%a` Alternatively, you could create backups with full dates in the filenames. This allows you to store more backups that just one week's worth. For that, you can use: Code:
today=`date +%Y%m%d` |
Thanks for the quick responses...
|
I hate shell, so I wrote this quickly using php and run it via cron
Its not perfect and it doesnt do much error chekcing yet but I only wrote it 10 minutes ago ;) so any improvements/critcism welcome ! Code:
#/usr/bin/php |
All times are GMT -5. The time now is 10:37 AM. |