Run tasks on a schedule. Meant for use in containers as a process running alongside the main container process.
Add your config file to /etc/crabbyloop/config.yaml, or set an alternative path using the -c flag whe starting
CrabbyLoop.
Make sure that your process manager starts CrabbyLoop.
- Bash. All jobs are executed by
/bin/bash -c.
Values can be:
tracedebuginfowarnwarningerrorerrcriticalcritemergencyemerg
Path to where logs should be written.
A list of jobs to run. Each list item consists of the following keys, all are required.
name: The name of the job. For your own use, as well as a value in logs.command: The actual command to run. It will be executed by/bin/bash -c.slash_mode:times_permeans that the job will be run N times in the parent time period. So if you set seconds to*/5, then the job will run five times per minute.every_nmeans that the job will run every N "time period". So if you set seconds to*/5, the job will run every 5 seconds.
For all timing keys, you can use * to match any time. All keys must be present. All keys must validate for a job to
run. You can use */<int> notation according to the slash_mode setting.
If you don't want a job to run every second during a valid minute/hour/etc. time period, make sure to explicitly set the second the job should run. The same applies for every minute when the job is hourly, and so on.
seconds:0-59minutes:0-59hours:0-23weekday:0-6, Sunday is0month:1-12
log_level: debug
log_file: /dev/stdout
jobs:
- name: grumpytalk
command: echo "grrr garr grrr"
slash_mode: "times_per"
seconds: "*/5" # Run 5 times per minute
minutes: "*" # Any second is valid
hours: "*" # Any hour is valid
weekday: "*" # Any weekday is valid
month: "*" # Any month is valid
- name: happytalk
command: echo "yay woo hoo yay"
slash_mode: "every_n"
seconds: "*" # Any second is valid
minutes: "*/10" # Run every 10 minutes,
# note that "*" in the seconds field means this
# will run every second for a minute every 10 minutes.
hours: "*" # Any hour is valid
weekday: "*" # Any weekday is valid
month: "*" # Any month is valid
- name: cheers
command: echo "YAAAAAY"
slash_mode: "every_n" # Doesn't effect the timing, but is required.
seconds: "0,30" # Run at 0 and 30 seconds
minutes: "4,9,23,45,57" # Run at *:04, *:09, *:23, *:45, and *:57
hours: "*" # Any hour is valid
weekday: "1,3,6" # Run on Mondays, Wednesdays, and Saturdays
month: "1" # Run during JanuaryCrabbyLoop needs to run with enough permissions to run the command you specify.
So, do your due diligence and check that the code you are running is safe.
If you find a security issue, please email david+security@reagannetworks.com.
CrabbyLoop is meant to be as simple as possible. So beyond fixing any issues I run into as I implement it, I don't foresee needing to add any new features.
The one area I would like to improve is automated testing. I'll be adding tests as I can, but any tips or pull requests are welcome.
I consulted JetBrains AI Assistant while developing CrabbyLoop. I did not just have it develop CrabbyLoop for me. I do not trust AI code unless I can fully understand it. So, while some code was copy and pasted, it was only after I made sure I understood it.