1

cron 语法中行首的加号和减号是什么意思?

+ 0 9 * * * /usr/bin/curl -k http://www.example.com/cron/deactivate_users
- 10 8 * * * /usr/bin/curl -k http://example.com/cron/delete_users
4

3 回答 3

4

从减号开始:

如果 crontab 中的一行以“-”开头,这将阻止 cron 将有关命令执行的信息写入 syslog。

请参阅 crontab 的联机帮助页 (5)。

于 2015-10-08T06:49:22.923 回答
2

There is no + or - */2 is there I think you have seen the above syntax somewhere where + means to add the line to curl and call deactivate_users and remove i.e - to remove delete_users or in short words to replace delete_users cronjob with the new cronjob of deactivate_users.

Thanks & Regards,
Alok Thaker

于 2013-09-24T09:56:44.413 回答
2

It (i.e. your lines starting with + or -) probably is the output of some GNU diff (or some other diff), so it is a patch file.

You may apply that patch with the patch command. Try perhaps patch < your.diff(or else patch -p0 < your.diff) where your.diff contains such lines starting with + or - (and also a few previous ones).

于 2013-09-24T10:28:26.240 回答