Rigel
Server
regular.py
Python script to coordinate recurring automation tasks. It reads a config file regular.csv and executes commands inside LXC containers at specified times and time intervals.
regular.csv
";
"-delimited CSV file, header line is "id;interval;start;depends;lxc_name;username;command
". Each subsequent line specifies a command and how and when it has to be run. lxc_name
specifies the LXC container under which to run, username
the user within that container and command
the exact command, which cannot have spaces in its arguments (true '1 2' 3
will evaluate to "true" "'1" "2'" "3"
):
$ sudo lxc-attach -n {lxc_name} -- sudo -u {username} -- {command.split(' ')}
start
is a 4-digit string in %H%M
format at which time the command should be excecuted, and interval
is a number of hours specifying how much hours after start
the command should be run again, e.g. 24, 12 or 8 for one, two and three runs a day respectively. The depends
column specifies whether the task is a parent task (empty depends
) or a child task. Children tasks will be executed exactly after their parent, specified bydepends
containing the id
of the parent, finishes execution. The parent must be in a line above the child's, and the child's interval
and start
values are ignored and can be empty. If multiple children depend on the same parent, they will be run in the order they are listed in the .csv file from top to bottom.