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.
<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.
Guest, hidden content will be shown only to users with 7777 points and above
---------------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
|