Running a cron every 30 seconds

后端 未结 19 1269
面向向阳花
面向向阳花 2020-11-22 10:56

Ok so I have a cron that I need to run every 30 seconds.

Here is what I have:

*/30 * * * * /bin/bash -l -c \'cd /srv/last_song/releases/2012030813315         


        
19条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 11:32

    Thanks for all the good answers. To make it simple I liked the mixed solution, with the control on crontab and the time division on the script. So this is what I did to run a script every 20 seconds (three times per minute). Crontab line:

     * * * * 1-6 ./a/b/checkAgendaScript >> /home/a/b/cronlogs/checkAgenda.log
    

    Script:

    cd /home/a/b/checkAgenda
    
    java -jar checkAgenda.jar
    sleep 20
    java -jar checkAgenda.jar 
    sleep 20
    java -jar checkAgenda.jar 
    

提交回复
热议问题