JayDz Posted August 12, 2015 Share Posted August 12, 2015 Hallo!Ik heb net een cron job ingesteld via cpanel.Graag zou ik via php een timer willen hebben om te laten zien hoelang het duurt voordat de cronjob opnieuw word uitgevoerd.Ik heb gegoogled maar kon hier jammergenoeg niets over vinden.Heeft iemand van jullie een idee?Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/297745-php-cron-job-timer/ Share on other sites More sharing options...
QuickOldCar Posted August 12, 2015 Share Posted August 12, 2015 Might need to translate this to english. Quote Link to comment https://forums.phpfreaks.com/topic/297745-php-cron-job-timer/#findComment-1518550 Share on other sites More sharing options...
JayDz Posted August 12, 2015 Author Share Posted August 12, 2015 Oh sorry, I tought this was a dutch forum somehow haha.I just configured a cron job on the cpanel of my domain.I would like to have a timer on a php page to see how long until the next cron job is executed.I tried googling but couldn't really find anything.Do any of you have an idea?Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/297745-php-cron-job-timer/#findComment-1518567 Share on other sites More sharing options...
QuickOldCar Posted August 12, 2015 Share Posted August 12, 2015 You can use time or date right in a cron job command and then save it to a log, then you parse your log data. I prefer to log something through the script itself. You can do a start/end in the php script itself and log to a database. Two timestamps for instance, you know when it started and when it ended, you can do calculations on the timestamps and whatever cron periods you have the jobs set for. If you need live data could poll the data with jquery or js/ajax Quote Link to comment https://forums.phpfreaks.com/topic/297745-php-cron-job-timer/#findComment-1518584 Share on other sites More sharing options...
gizmola Posted August 12, 2015 Share Posted August 12, 2015 Unfortunately cron jobs are fairly archaic and opaque. You could create the illusion of a schedule in javascript and present countdown timers, so long as you either codify the cron schedule, or read it and parse it, however given the use of directories like cron.daily/weekly/hourly and the possibility of having many different users owning cron jobs, there is nothing out there that already does this for you that I am aware of. If there are cronjobs installed you can get the raw crontab listing using: crontab -l But then you get something like this: * * * * * /var/www/foo/utility/something.sh params You'd be re-wrting the cron parser before you even began to figure out rendering a display and timers. Quote Link to comment https://forums.phpfreaks.com/topic/297745-php-cron-job-timer/#findComment-1518607 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.