Scheduler for periodical script execution

by Bushmills

Version 5 (December 8, 2021)

Download (54 downloads)

A scheduler for periodic script execution. Scripts can be executed at daily, weekly or monthly intervals.

When launched, will this flow look into a directory, configurable but defaulting to "{storage()}/cron)", and fork a new fiber for each directory by the names "daily", "weekly" and "monthly" in there. Each fiber waits for its moment in time to trigger. Configured in the variable "crontab", they default to 04:30 (daily), 04:15 every Sunday (weekly) and 04:00 on every first day of the month (monthly). When triggered, all scripts in the respective daily, weekly or monthly directories will be executed. By default will sh be used as script interpreter, but scripts may contain a hashbang on first line for specifying other script interpreters.

On the right side of the flow are three blocks to deal with logging by invoking an external flow, and branching around this logging flow in case it doesn't exist.
My flows log through this separate flow in order to provide a central point for determining log entry format and location.
If not interested in logging to file at all, you may want to remove these three blocks, and connect the bottom shell block directly to the for each input. Alternatively, provide a logging flow, or put logic for logging to file there instead (and - optionally - remove the failure trapping blocks). Or just do nothing and live with Automate logging reporting red "missing flow" error lines.

This flow is meant as alternative to https://llamalab.com/automate/community/flows/38403 for providing fixed times for events.

5.0 average rating from 1 reviews

5 stars
1
4 stars
0
3 stars
0
2 stars
0
1 star
0
Reports
0

Rate and review within the app in the Community section.