Doesn't depend on time once a day crontab?

I have a python script and I want to run it once and only once every day. I've done some research on the team crontab

and it looks like it does, but at a specific time every day. The problem is that my computer will not be available for the whole day, and a specific start time is simply impossible. What can I do?

Can the log file help? I thought about doing crontab

every 5 minutes or so and scanning the log file to see any runs during the day.

+3


source to share


4 answers


Install a anacron

scheduler cron

that will process tasks that run no more than once a day when you turn on your computer.

From the WikiPedia page:



anacron is a computer program that performs periodic command scheduling, which is traditionally done by cron, but without assuming that the system is running continuously. Thus, it can be used to manage daily, weekly, and monthly jobs (or anything with a period of n days) on systems that are not running 24 hours a day.

+7


source


Anacron will do it

or



at

Anacron is probably your best bet.

0


source


@reboot

can be used in a crontab entry to run a script one time when the system reboots.

eg.

[test@host1 ~]$crontab -l    
@reboot     /home/test/bootScript.sh

      

0


source


You can run it on a server that runs all day, every day. You can get free hosting on these sites: https://www.5gbfree.com/

This way, if you have sick days when you don't even think to open your laptop, cron job

it will still work on the server.

0


source







All Articles