Intelligent interface to cron in UNIX systems
Run pip install supercron.
SuperCron is based on crontab, while providing the following additional advantages:
SuperCron can run either in interactive mode or non-interactive mode.
Run supercron without any arguments to start interactive mode. You will prompted to choose an action, and then to enter action parameters (like name, command and repetition) if any.
In non-interactive mode, one of the following options can be used after the command name supercron.
Additionally, one of the following subcommands can be used: add, delete, enable, disable, search, clear, trigger.
Subcommands delete, enable and disable
Note: this subcommand will only clear SuperCron jobs from user’s crontab.
Triggers can take one of 2 forms:
ACTION is the action applied on the enabled state of the triggered job and it can be on, off or toggle.
NAME is the name of the triggering job.
STATE is the triggering state of the triggering job, and it can be enabled, disabled, toggled, added or deleted.
Using action toggle means to enable the triggered job if it was disabled, and to disable it if it was enabled.
State toggled activates the trigger when the triggering job is enabled or disabled.
Note that when a job is renamed from name1 to name2, it means activating triggers that end with if name1 is deleted and triggers that end with if name2 is added, since a rename is considered a deletion of the old job name and an addition of the new job name.
Add a job:
supercron add -c "date +%j >> log_file" -r "every 2 days" log_dates supercron add -c "scp -r /path1 user@server:/path2" -r "at 11:50 pm on mondays" backup_server
Rename a job:
supercron rename log_dates log_all_dates
Delete a job:
supercron delete log_dates
Enable a job:
supercron enable log_dates
Disable a job:
supercron disable log_dates
supercron search log_dates supercron search @supercron supercron search @all
Clear all SuperCron jobs:
Add trigger to a job:
supercron trigger -t "on if log_months is off" log_days
Remove trigger from a job:
supercron trigger -t none log_days
Repetition sentences are provided in a supercron add command directly after the -r or --repetition option.
Examples of accepted repetition sentences (case insensitive):
Repetition sentences can also be any (unsorted) logical mix of the above. For example: