<cron job, how do I make a script run in half a minute? >
Cron is not going to make it. But can be implemented with the help of the sleep command.
Workaround:
Two scripts
A normal, an increase in SLEEP30
Crontab setting starts at the same time
Sleep in some shells (such as bash in Linux) to support sleeping (minutes, hours)
Sleep can be used to delay the current action for a period of time
"Sleep parameter Description:"
--HELP: Display auxiliary messages
--version: Display version number
Number: Length of time, followed by S, M, H or D
Where S is the second, M is minutes, H is the hour, D is the number of days
Delay 1 minutes after displaying the current time, and then display the time again:
Date;sleep 1m;date
Sleep 1 sleeps 1 seconds
sleep 1s 1 seconds
Sleep 1m 1 min.
Sleeping 1h sleep 1 hours
Let one of the scripts sleep for 30 seconds, and the other to run correctly
(For example):
A.sh is your script.
Write a b.sh script again
The contents are as follows:
!#/bin/bash
Sleep 30
a.sh
Then add both scripts to the cron and set the same starting condition (minutes are *)
* * * * * */path/a.sh; /Path/b.sh
If you perform every 10 seconds, add the following in b.sh: