Mainos / Advertisement:

Crontab

Kohteesta Taisto
Siirry navigaatioon Siirry hakuun
Tämä on käännetty versio sivusta Crontab, ja käännös on 100 % valmis.

Muut kielet:
English • ‎suomi

Crontab is a useful tool to schedule tasks in Linux.

Scheduling

Scheduling tasks with crontab is pretty simple:

 *    *    *    *    *  command to be run
 ┬    ┬    ┬    ┬    ┬
 │    │    │    │    │
 │    │    │    │    └───── weekday (0 - 7) (0 or 7 = sunday)
 │    │    │    └────────── month (1 - 12)
 │    │    └─────────────── day (1 - 31)
 │    └──────────────────── hour (0 - 23)
 └───────────────────────── minute (0 - 59)

The crontab configuration file is

 /etc/crontab

Scheduling examples

Print something every minute

 */1 *   * * * echo "This prints every minute."


Print something every hour

 0 1 *   * * * root echo"This prints something every hour."

Run a sh script every hour

  0 1 *   * * * root sh /root/backup.sh

Update dynamic DNS every Friday and Monday at 3:45

 45 3	* * 1,5 root	 curl -D - --user useraccount:password http://www.dy.fi/nic/update?hostname=hostname.dy.fi

Disable e-mail notifications

Add the following line to the /etc/crontab file

 MAILTO=""

Related info

Backup

Dynaaminen dns päivitys dy.fi

Sources

http://linux.fi/wiki/Komentojen_ajastaminen (Finnish)

http://forum.ubuntu-fi.org/index.php?topic=8541 (Finnish)

Mainos / Advertisement: