LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   dd iand crontab (http://www.linuxquestions.org/questions/linux-software-2/dd-iand-crontab-611584/)

SolarisZen 01-06-2008 05:16 PM

dd iand crontab
 
Hi again. I hope everyone out there in Linux land had a good new years!

Well I have been progressing in my disaster and recovery stratagy. I have cloned the HD to an external usb HD and all i would like now is to have cron do a backup every so often using dd

so I used this to clone my Linux server

Code:

dd if=/dev/sdb of=/dev/hda conv=notrunc,noerror

How do I implement crontab to to the backup for me automatically using dd?

jphilput 01-07-2008 10:05 AM

In some cases I've seen cron die when confronted with a "long" command line, so the first thing that I would suggest is to put your dd command into a basic script like:

Code:

#!/bin/bash
dd if=/dev/sdb of=/dev/hda conv=notrunc,noerror

Then you can add it to root's crontab with the crontab -e command. The new line should look something like this:

Code:

* * * * * /path/to/ddscript
Each of the * characters is a place holder for a time, minute of the hour, hour of the day, day of the month, month, day of the week. The wikipedia entry for crontab has a good description of how to set the execution time.

SolarisZen 01-08-2008 07:22 PM

Quote:

Originally Posted by jphilput (Post 3014450)
In some cases I've seen cron die when confronted with a "long" command line, so the first thing that I would suggest is to put your dd command into a basic script like:

Code:

#!/bin/bash
dd if=/dev/sdb of=/dev/hda conv=notrunc,noerror

Then you can add it to root's crontab with the crontab -e command. The new line should look something like this:

Code:

* * * * * /path/to/ddscript
Each of the * characters is a place holder for a time, minute of the hour, hour of the day, day of the month, month, day of the week. The wikipedia entry for crontab has a good description of how to set the execution time.


Thank you so much jphilput! Your information was perfect. Love this community! :D


All times are GMT -5. The time now is 10:50 AM.