heroku - How to schedule task with certain (say, 5) hour period? -
it common use crontab schedule task. however, found crontab can schedule tasks on minutely, hourly or daily basis. if want schedule task on every 4 hours, can still make setting 6 daily task. however, if want have period doesn't make 1 day, say, task every 5 hours / 7 hours? there way set task hour period in crontab or using other tools? (would better if tool can run on paas heroku / openshift)
here example of using minutely crontab setup task happens every 5 minutes (https://github.com/openshift-quickstart/openshift-cacti-quickstart/blob/master/.openshift/cron/minutely/cactipoll)
if [ ! -f $openshift_data_dir/last_run ]; touch $openshift_data_dir/last_run fi if [[ $(find $openshift_data_dir/last_run -mmin +4) ]]; #run every 5 mins rm -f $openshift_data_dir/last_run touch $openshift_data_dir/last_run php $openshift_repo_dir/php/poller.php > $openshift_data_dir/cacti.log 2>&1 fi
basically task runs every minute, gets executed after 5 minutes have passed. can adapt use hours instead of minutes.
Comments
Post a Comment