Главная > Без рубрики > Crontab xenserver

Crontab xenserver

http://knowledgelayer.softlayer.com/questions/193/How+to+run+scripts+automatically+using+crontab.

How to run scripts automatically using crontab.
Would you like to…
Print this page
Email this page
Add to favorites
You can use the crontab to automate the running of scripts on your server. Cron is started automatically on entering multi-user run levels. To view your crontab, log in as the root user and run:

#crontab -l

The structure of the crontab entries is:

* * * * * command to be executed
- - - - -
| | | | |
| | | | +—– day of week (0 - 6) (Sunday=0)
| | | +——- month (1 - 12)
| | +——— day of month (1 - 31)
| +———– hour (0 - 23)
+————- min (0 - 59)

So for example:

* * * * * /sbin/ping -c 1 192.168.0.1 > /dev/null

This will ping 192.168.0.1 once each minute continuously. The > /dev/null portion redirects standard output to /dev/null so that the root user is only emailed if there is an error running the command. You can change this to > /dev/null 2>&1 to also trash error output.

To edit your crontab, run:
#crontab -e

Note: The text editor you use will be defined by the EDITOR variable. If you want to use a simple text editor, run the following command before editing the crontab:

# export EDITOR=nano

admin Без рубрики

  1. Habiba
    | #1

    I found myself nodding my noggin all the way tohrugh.

  1. Пока что нет уведомлений.