Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我为Ruby定义了一个定时任务。这为每 5 分钟运行一次 ruby 脚本的用户创建了一个 cron 作业。用户不是root btw,也没有root权限。
我希望能够在 3-6 分钟之间随机运行这项工作。我在 CentOS 6.2 上运行这个工作
我认为您可以做的最好的事情是设置 cron 以每分钟运行一次脚本,并让脚本决定何时实际执行它的工作。您可以通过跟踪上次执行脚本的时间来获得随机效果
只需让脚本在动作之间随机延迟连续运行即可。将其作为@reboot 放入cron 中,当系统启动时它将重新启动。