简体   繁体   English

清除crontab更改了终端cron消息传递的格式

[英]Clearing crontab changed format of terminal cron messaging

I'm using the latest version of the whenever gem with Rails 3.1.1 for cron tasks. 我正在将Rails 3.1.1的每当gem的最新版本用于cron任务。 After I used the whenever command on the terminal 在终端上使用everyever命令之后

whenever -c

to clear the crontab, whenever I type in 每次输入时清除crontab

crontab -l

whereas it used to say something like "there are no cron tasks" (this is not verbatim) now it just displays a blank space about the size of two empty lines. 以前它说的是“没有cron任务”(不是逐字记录),现在它只显示一个空白,大约是两个空行的大小。 Also if I have a cron task setup and I type the same command into the terminal again, those two empty lines come up before it shows the cron tasks. 另外,如果我具有cron任务设置,并且再次在终端中键入相同的命令,则在显示cron任务之前会出现这两个空行。 I'm sorry if this is a minor issue. 如果这是一个小问题,对不起。 Everything appears to be working fine but I just want to make sure I didn't screw anything up that'll come back to haunt me somewhere down the line. 一切似乎都正常,但我只想确保自己没有搞砸任何东西,否则会再次困扰我。 Thanks! 谢谢!

You need to change the task in the schedule.rb file which is generated by whenever gem. 您需要在每当gem生成的schedule.rb文件中更改任务。

After changing your cron task in the schedule.rb you have to update your crontab file and you can use this command to do that :- 在schedule.rb中更改cron任务后,您必须更新crontab文件,并且可以使用此命令来执行此操作:

whenever --update-crontab f(here f is your application name) 每当--update-crontab f(此处f是您的应用程序名称)

crontab -l is used to see your current crontab file. crontab -l用于查看当前的crontab文件。

Hope it helps 希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM