Link to home
Start Free TrialLog in
Avatar of XK8ER
XK8ERFlag for United States of America

asked on

run cronjob

hello there,
I would like to setup a cronjob to run every day every 24 hours but with a twist..
if it possible to run lets say today at 1:00pm then tomorrow at 1:01 then the next day 1:02 etc..
each day and extra minute.. is this possible?
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

this is not possible with cron itself

may I ask why you need such a scheduling?
and also, will it "reset" to 1pm at some time? for example, when it reached 2pm or so?
or once per month reset to 1pm?
please clarify
You could start a shell script at 1pm every day and have the shell script write a log file to a folder.

Then for each log file it finds in the folder do a "sleep 60" command:

#! /bin/sh
for i in /logfolderdirectory
do
  sleep 60
done

The shell script could then go on to do whatever task you want it to do.
I should have said - obviously the log files would have to have unique names - something like:
myshellscript > logfile.`date +%y%m%d`
so the logfile's name would have the day's date in yymmdd format appended to it.
Avatar of XK8ER

ASKER

I am trying to run a php script.. and for example it takes about 30 seconds to finish running..
so I need to run it exactly 24 hours after finishing.. so if I run it every 24hrs its 30 seconds too early..
ASKER CERTIFIED SOLUTION
Avatar of Martin_J_Parker
Martin_J_Parker
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial