ruby 插件/gem 将 cron 转换为人类可读的格式
是否有一个 ruby gem/插件可以将 */10 * * * 1,3 之类的内容转换为“周一、周三每 10 分钟触发一次”?
Is there a ruby gem/plugin which will convert something like */10 * * * 1,3 to "Triggers every 10 minutes on Monday, Wednesday" ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我什么都不知道,我也没有通过谷歌找到任何东西。不过,您也许可以自己将一些东西组合在一起:
一旦有了变量,您就可以开始为输出组装各个部分:
显然,这只是一些粗略的想法(例如,您可能需要一个带有捕获组的正则表达式来解析条目),但由于 crontab 条目已明确指定,因此想出适用于您可能遇到的大多数条目的内容应该不会太难。
There's nothing I know of and I also didn't find anything with Google. You may be able to hack something together on your own though:
Once you have the vars, you can start assembling the parts for your output:
Obviously that's just some rough ideas (for example you may want a regex with capture groups for parsing the entry), but since the crontab entries are well specified, it shouldn't be too hard to come up with something that works for most of the entries you are likely to encounter.
我基于 Sean Burke 的 Perl 脚本编写了一个 Ruby gem 来执行此操作:
https://github.com/pjungwir/cron2english
I wrote a Ruby gem to do this, based on Sean Burke's Perl script:
https://github.com/pjungwir/cron2english
这就是您要找的:)
http://www.joostbrugman .com/bitsoftthought/page/4/Converting_Crontab_Entries_To_Plain_English_%28Or_Any_Other_Language%29
http://crontranslator.appspot.com/
This is what you're looking for :)
http://www.joostbrugman.com/bitsofthought/page/4/Converting_Crontab_Entries_To_Plain_English_%28Or_Any_Other_Language%29
http://crontranslator.appspot.com/
看看 Ruby gem cronex
https://github.com/alpinweis/cronex
Have a look at Ruby gem cronex
https://github.com/alpinweis/cronex