crontab命令的功能是在一定的时间间隔调度一些命令,同windows下的任务计划功能相似. 在/etc目录下有一个crontab文件,这里存放有系统运行的一些调度程序,每个用户可以建立自己的调度crontab。


crontab [-u user] [file]
crontab [-u user] [-e|-l|-r]
crontab -l -u [-e|-l|-r]

-e    编辑该用户下的时间间隔调度命令。
-l  列出该用户下的时间间隔调度命令。
-r  删除该用户下的时间间隔调度命令。


执行命令crontab -u user -r即可删除当前用户的所有的cron作业。

crontab文件的格式:M H D m d cmd.
M:0~59 表示分
H:1~23 表示小时
D:1~31 表示日
m:1~12 表示月份
d:0~6 表示星期(其中0表示星期日)


下面看看例子 :

#每天早上7点执行一次 /bin/ls :
0 7 * * * /bin/ls

0 1 * * 5 tar czvf /home/www.tar.gz  /var/www


  1. Hey There. I found your blog using msn. This is a really well written article. I will be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I will certainly comeback.

  2. Good post. I learn one thing more challenging on completely different blogs everyday. It is going to always be stimulating to read content material from other writers and practice a bit of one thing from their store. I’d desire to make use of some with the content material on my weblog whether you don’t mind. Natually I’ll offer you a link on your net blog. Thanks for sharing.

  3. I like the helpful info you provide in your articles. I will bookmark your weblog and check again here frequently. I am quite certain I will learn plenty of new stuff right here! Good luck for the next!

  4. We highly appreciate your blog post. You will find dozens of means we could put it to proper use while using minimal effort in time and resources. Thank you so much with regard to helping make the post respond to many issues we have encountered before now.

  5. I was very pleased to find this site.I wished to thank you for this fantastic read!! I definitely enjoying every little bit of it and I have you saved to check out new stuff you post. Regards, Cori.


电子邮件地址不会被公开。 必填项已用*标注

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>