BDMV.INFO

 Retrieve Password
 register now
Search
Hot: #
!show!: 14398|Reply: 0

[2014.02.16] Add the Backup Script into Crontab Job [Copy URL]

Rank: 9Rank: 9Rank: 9

Post time 2014-2-16 13:17:08 |Show all posts
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



You have to log in before you can reply Login | register now

Archiver|Cell Phone|BDMV.INFO

GMT+8, 2024-12-6 08:53 , Processed in 0.014266 second(s), 7 queries , Xcache On.

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

Top