-
Intro to Cron and How to
2006-05-11 | Tag:cron
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://rp3tech.blogbus.com/logs/2447690.html
Automating Tasks with cron services
cron process cannot be started
Newbie: Intro to cron
temp
anyone have cron binary for Solaris 2.5?
crontab命令详解
----------------------------------------------------------------------------------------------
To find out if cron is running do the following:
cog@pingu $ ps aux | grep crond
root 311 0.0 0.7 1284 112 ? S Dec24 0:00 crond
cog 8606 4.0 2.6 1148 388 tty2 S 12:47 0:00 grep crond
To start it, just add the line crond to one of your start up scripts. The
process automatically goes into the back ground, so you don't have to force
it with &. Cron will be started next time you reboot. To run it without
rebooting, just type crond as root:
root@pingu # crond
if you wrote a crontab called cogs.cron.file, you would use the cmd
cog@pingu $ crontab cogs.cron.file
to replace your existing crontab with the one in cogs.cron.file. You can use
cog@pingu $ crontab -l
to list your current crontab, and
cog@pingu $ crontab -r
will remove (i.e. delete) your current crontab. Privileged users can also change other user's crontab with:
root@pingu # crontab -u
and then following it with either the name of a file to replace the existing user's crontab, or one of the -e, -l or -r options.
According to the documentation the crontab command can be confused by the
su command, so if you running a su'ed shell, then it is recommended you
use the -u option anyway.
crontab -l -u [-e|-l|-r] 第一个命令行中,file是命令文件的名字。如果在命令行中指定了这个文件,那么执行crontab命令,则将这个文件拷贝到crontabs目录下;如果在命令行中没有制定这个文件,crontab命令将接受标准输入(键盘)上键入的命令,并将他们也存放在crontab目录下。
命令行中-r选项的作用是从/usr/spool/cron/crontabs目录下删除用户定义的文件crontab;
命令行中-l选项的作用是显示用户crontab文件的内容。
使用命令crontab -u user -e命令编辑用户user的cron(c)作业。用户通过编辑文件来增加或修改任何作业请求。
执行命令crontab -u user -r即可删除当前用户的所有的cron作业。
作业与它们预定的时间储存在文件/usr/spool/cron/crontabs/username里。username使用户名,在相应的文件中存放着该用户所要运行的命令。命令执行的结果,无论是标准输出还是错误输出,都将以邮件形式发给用户。文件里的每一个请求必须包含以spaces和tabs分割的六个域。前五个字段可以取整数值,指定何时开始工作,第六个域是字符串,称为命令字段,其中包括了crontab调度执行的命令。随机文章:
香菜的英文是coriander 2008-03-20文件上传 2006-06-22JSP Upload 2006-06-20Linux/Solaris Network configuration 2006-05-23Unicode轉換Big5 2006-02-12
收藏到:Del.icio.us








评论