Publish time 2014-2-16 13:17:08

[2014.02.16] Add the Backup Script into Crontab Job

I would like to add a shell script to crontab, I hope to relay on the script and  the cloud sync app to save the backup of something imoportant files liking database or file system every day.

http://blessing.bdmv.info/tutorial/crontab02.png

<Some key points people need to pay attention>
1. Permission : if the script user of the crontab (/etc/crontab) is root, the script need change the ower to root and provide the writing permission to root.
2. Abolute patch : Because of the script has a lot of commands  doing rar ot gizp archive, the location of compressing target use the absulute patch is better. ( See below example picture)
3. Put the #!/bin/sh at the script begaining : In ubuntu sh is the same as the command dash and in the centos is the same as bash, in fact, I still can't know all the difference of dash and bash. (See below example picture)
4. Crontab limition: people need serach much more detail information form google/wikipedia yourself, some script grammar may different with crontab.

http://blessing.bdmv.info/tutorial/crontab01.png

**** Hidden Message *****

---------------reference---------------
http://www.pcdvd.com.tw/showthread.php?t=1039626
http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?topic_id=79374
http://tigermax.dyndns.org/bbs/forum.php?mod=viewthread&tid=9449
http://2d-gate.org/thread-5128-1-1.html
http://stackoverflow.com/questions/8967902/why-do-you-need-to-put-bin-bash-at-the-beginning-of-a-script-file
http://www.mkssoftware.com/docs/man1/crontab.1.asp
http://linux.vbird.org/linux_basic/0340bashshell-scripts.php



Pages: [1]
View full version: [2014.02.16] Add the Backup Script into Crontab Job