Results 1 to 2 of 2
hi, i would like to write a script that will automatically schedule backup of company network system. currently Iam manually doing it everyweek. this what i usually do to backup ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-20-2008 #1
- Join Date
- Apr 2008
i would like to write a script that will automatically schedule backup of company network system.
currently Iam manually doing it everyweek. this what i usually do to backup manually.
./backup -p xxxxxxxx sssssss zzzzzzzz
xxxx ---denotes password
ssss---- denotes target node
sorry am still new withlinux
- 04-21-2008 #2
This is a perfect application for cron. Cron runs applications at designated times for the system, administrator and users.
See man cron and man crontab for documentation.
The simplest way would be to create a file something like this, say ~/tmp/c.txt. In this example the backup command is run every Sunday morning at 10 minutes past midnight:
# Time fields: minute, hour, day, month, day-of-week (0 or 7 is Sun) MAILTO=ben 10 0 * * 0 $HOME/bin/backup -p xxxxxxxx sssssss zzzzzzzz
I would recommend you NOT put a password on the command line like that. If you run crontab as root then it will be run as root and you won't need the password.
Note that the PATH variable may not be what you expect when it is run, so you should specify paths. The MAILTO variable is optional, but it's wise to set it so the stdout output is emailed to the specified user.