Run a php or py script once at a unique dynamic wanted time

by emma   Last Updated July 12, 2019 09:02 AM - source

I have a small bot currently written in php but i can switch to py if need be.

It basically gathers data from an api about tasks that need to be ran only once in order to be updated the next day at certain unique times

Each day at UTC+0 00:00 i use a cron job to gather that data from the api.

For example a task might need to run at UTC+0 09:00 another one at UTC+0 10:15 and another one at UTC+0 11:30. The next day there are new tasks that need to run at different times.

Now since those tasks are only available for that day i don't think that setting a cron job for each of them at the desired time is a solution and then delete the cron job.

Therefore, how do i run a script just when the task needs to be updated?

For now i'm running a cron job each minute and if there is a task within a minute range i'm running another script that updates that task but that seems messy to me and i'm wondering if i could do something about it.

P.S: I'm using a droplet from digitalocean that runs on Ubuntu 19.04 - disco



Related Questions



cron job wont execute the script

Updated June 23, 2015 03:00 AM

"rm: not found" by apt, cron and others

Updated September 14, 2015 04:01 AM

Cron Wont Run - Ubuntu Server 14.04

Updated September 23, 2015 23:01 PM

How to run scripts every 5 seconds?

Updated March 09, 2017 20:02 PM