Retrieve Password
 register now
Hot: #
!show!: 12585|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


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

Archiver|Cell Phone|BDMV.INFO

GMT+8, 2024-2-25 15:42 , Processed in 0.013978 second(s), 7 queries , Xcache On.

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.