I have a bash script that should be executed on ubuntu startup after boot.
The problem is the script should be only executed once a day.
So when the script recognizes that it already has been executed today it should stop itself. How can i do this?
Best Answer
As Ubuntu uses Anacron by default, you already have this behaviour by putting the script into
/etc/cron.daily
. Checkrun-parts --test /etc/cron.daily
to check if your script is picked up (importantly, no .sh extension and the +x bit set). See this wiki page andman anacron
for more detailed information about why this will work for you.