Running a cron every 30 seconds

后端 未结 19 1181
面向向阳花
面向向阳花 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:24

    Run in a shell loop, example:

    #!/bin/sh    
    counter=1
    while true ; do
     echo $counter
     counter=$((counter+1))
     if [[ "$counter" -eq 60 ]]; then
      counter=0
     fi
     wget -q http://localhost/tool/heartbeat/ -O - > /dev/null 2>&1 &
     sleep 1
    done
    

提交回复
热议问题