php - execute cron job every 2 hour with 30 min duration -
i have searched so, can't seem find topic covering little problem.
i'm quite new cron jobs.
i have ip based alarm. alarm can control wireless power outlets, turning them on , off within web based control panel. can control power outlets simple http command, making them turn on , off.
i have made php script taking care of this. right 2 separate scripts, 1 turning on , 1 turning off. script controlling 1 specific power outlet.
my problem need time based switching scheme. first thought of making php script sleep, @ sleep time 1 hour, not first choice.
so here go.
is possible set cron job to:
1: run on script 1 sec, trigger http command in script. 2: wait 1 hour. 3: run off script 1 sec trigger http command. 4: wait 2 hours. 5: start on again.
there no problem alarm system, sending off http command if power outlet off, , vice versa.
you can combine commands single , run every 3 hours.
0 */3 * * * /path/to/1st_script; sleep 3600; /path/to/2nd_script
this run 1st_script every 3 hours on 0-minute, wait 1 hour, run 2nd_script.
Comments
Post a Comment