Results 1 to 2 of 2
Thread: script help
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 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
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.