Running a cron every 30 seconds

后端 未结 19 1183
面向向阳花
面向向阳花 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条回答
  •  旧时难觅i
    2020-11-22 11:43

    Cron's granularity is in minutes and was not designed to wake up every x seconds to run something. Run your repeating task within a loop and it should do what you need:

    #!/bin/env bash
    while [ true ]; do
     sleep 30
     # do what you need to here
    done
    

提交回复
热议问题