by L Schmidt
anacron is a scheduler for non-accurately timed periodical script execution. Scripts are executed at hourly, daily, weekly and monthly intervals.
This flow, when launched, creates directories hourly, daily, weekly and monthly as subdirectories of a configurable directory, defaulting to the name "anacron". For a script to get executed at the desired interval, place it in the corresponding directory. Each directory can hold an arbitrary number of scripts.
By default, sh will be used to execute these scripts. For scripts beginning with a hashbang, the interpreter specified there will be used instead. Note that the home directory that interpreter changes to may be different from /storage/emulated/0 to which automate shell command execution defaults to - use canonical paths or change to the desired directory in your script.
I'm using anacron mostly for launching bash scripts which rotate logs, remove historic logs, rsync mobile devices with NAS, trimming file systems. I'm considering to introduce a "boot" directory next to the periodic execution directories.
Version 9 added changes to make anacron timing a tad less non-accurate.
For periodic script execution at fixed times please use https://llamalab.com/automate/community/flows/40563 instead.
As Ricardo Fernández Serrata pointed out, do legacy Androids not provide the sed utility, which I've used in versions prior to 6 for extracting a possible hashbang. For improved compatibility do versions 6 and later use Automate functions for that purpose. Thank you, Ricardo Fernández Serrata!
Rate and review within the app in the Community section.