Find the answer to your Linux question:
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.
  1. #1
    Just Joined!
    Join Date
    Apr 2008
    Posts
    2

    script help


    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 manually.

    ./backup -p xxxxxxxx sssssss zzzzzzzz

    xxxx ---denotes password
    ssss---- denotes target node
    zzzz----backup location

    sorry am still new withlinux

    thnx
    ben

  2. #2
    Linux Enthusiast KenJackson's Avatar
    Join Date
    Jun 2006
    Location
    Maryland, USA
    Posts
    510
    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:
    Code:
    # 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
    Then run the command:
    crontab ~/tmp/c.txt

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •