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:
Then run the command:
# Time fields: minute, hour, day, month, day-of-week (0 or 7 is Sun)
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.