马孔多不下雪

Head Pic: 「恋恋 匕首」/「千夜QYS3」[pixiv]

Introduction

Crontab is a file that schedules commands running any time you want.

The daemon, which is crond, of crontab will check scheduled works every minute.

Usage

Every user has its own crontab file, which named by its name in /var/spool/cron/crontab.

In this file, every line stands for a task and every field in each line stands for a configuration.

1
2
3
4
5
6
7
8
#  -- minute(0 - 60)
# | -- hour(0 - 23)
# | | -- day(0 - 31)
# | | | -- month(1 - 12)
# | | | | -- week(0 - 7,sunday=0 or 7)
# | | | | |
# | | | | |
* * * * * <command>

Sample

The backup.sh will be executed at 03:50 every day.

1
50 3 * * * /home/backup/backup.sh

Tips

Absolute directory must be used if you run a script.