如何指定作业的开始和结束?
示例每隔5分钟执行一次,从凌晨5点开始,到晚上10点结束。这有可能吗?
答案 0 :(得分:0)
Cron的语法是
*/5 5-22 * * * sh ./script.sh
解释
*/5 5-22 * * * sh ./script.sh
\ \ \ \ \_every week day
\ \ \ \__every month
\ \ \___every day
\ \_______every hour between 0500 (5 AM) and 2200 (10 PM)
\__________every 5 minutes
以下是
时的方法# schedule.rb
every '*/5 5-22 * * *' do
command "echo 'crontab syntax is useful'"
end