• news
  • pics
  • linux
  • windows
  • proxmox
  • game
  • news
  • pics
  • linux
  • windows
  • proxmox
  • game
Home
linux

how to use crontab to excute tasks on time

like windows has scheduled tasks.linux has crontab.
it’s a tool for excute tasks on time.

how to install crontab?we can use yum.
yum install vixie-cron crontabs
then run it
service crond start
we can add it into autostart when we open the computer.
chkconfig --level 345 crond on

how to use crontab
run following command to start crontab edit mode.
crontab -e

crontabs’ format

Example of job definition:
 .---------------- minute (0 - 59)
 | .------------- hour (0 - 23)
 | | .---------- day of month (1 - 31)
 | | | .------- month (1 - 12) OR jan,feb,mar,apr …
 | | | | .---- day of week (0 - 6) (Sunday=0 or 7) or sun,mon,tue,wed,thu,fri,sat
 | | | | |
 * * * * * user-name command to be executed

In addition to numbers, there are several special symbols that are “*” ,”/” and “-“.
“*” representing all the numbers in the range of values,”/”representing each meaning,”*/5″representing every five units,”-“representing from a number to a number, and”,”separating several discrete numbers.

for example:
30 2 * * * sh xx.sh run “sh xx.sh” on 2:30am everyday.
*/10 * * * 1-5 sh xx.sh from Monday to Friday, run task every ten minutes.
0 17 1,5 * * sh xx.sh every month,on the first and fifth day,when 17:00pm,run the task.

we can use crontab -l to check the scheduled tasks.

Previous article build website platform. LAMP
Next article how to run a task automatic when system boot

therock

2 Comments

  1. free shemale dating service
    May 19, 2021 at 7:25 pm

    free dating sites no cost

  2. tinder review for guys
    May 16, 2021 at 4:37 pm

    tinder review for guys

    how to use crontab to excute tasks on time – rock funs

Meta
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Categories
  • game
  • linux
  • news
  • pics
  • proxmox
  • windows
Recent Posts
  • proxmox7.3直通显卡
  • Proxmox VE 直通显卡方案及解决N卡Code43
  • Linux系统出现:You have new mail in /var/spool/mail/root 的原因及解决办法
  • debian系统解决中文乱码
  • pve添加git和pvetools
Recent Comments
  • EdgarTot on proxmox7.3直通显卡
  • Ashvem on proxmox7.3直通显卡
  • Tedvem on proxmox7.3直通显卡
  • Jackvem on proxmox7.3直通显卡
  • Miavem on proxmox7.3直通显卡
Archives
  • March 2023 (1)
  • December 2022 (4)
  • November 2022 (6)
  • April 2022 (1)
  • February 2022 (5)
  • January 2022 (2)
  • December 2021 (3)
  • November 2021 (1)
  • October 2021 (2)
  • September 2021 (1)
  • August 2021 (1)
  • July 2021 (8)
  • June 2021 (14)
  • May 2021 (2)
  • April 2021 (2)
  • March 2021 (10)
  • January 2021 (4)
  • December 2020 (4)
  • November 2020 (13)
  • April 2020 (276)
  • March 2020 (1)
  • June 2019 (5)
  • May 2019 (10)
  • December 2015 (1)