Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

6 Commits

Repository files navigation

CrabbyLoop

Run tasks on a schedule. Meant for use in containers as a process running alongside the main container process.

Usage

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.

Dependencies

  • Bash. All jobs are executed by /bin/bash -c.

Configuration

Global

log_level

Values can be:

  • trace
  • debug
  • info
  • warn
  • warning
  • error
  • err
  • critical
  • crit
  • emergency
  • emerg

log_file

Path to where logs should be written.

jobs

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_per means 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_n means that the job will run every N "time period". So if you set seconds to */5, the job will run every 5 seconds.

Timing keys

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-59
  • minutes: 0-59
  • hours: 0-23
  • weekday: 0-6, Sunday is 0
  • month: 1-12

Examples

log_level: debuglog_file: /dev/stdoutjobs:
- name: grumpytalkcommand: echo "grrr garr grrr"slash_mode: "times_per"seconds: "*/5"# Run 5 times per minuteminutes: "*"# Any second is validhours: "*"# Any hour is validweekday: "*"# Any weekday is validmonth: "*"# Any month is valid
- name: happytalkcommand: echo "yay woo hoo yay"slash_mode: "every_n"seconds: "*"# Any second is validminutes: "*/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 validweekday: "*"# Any weekday is validmonth: "*"# Any month is valid
- name: cheerscommand: echo "YAAAAAY"slash_mode: "every_n"# Doesn't effect the timing, but is required.seconds: "0,30"# Run at 0 and 30 secondsminutes: "4,9,23,45,57"# Run at *:04, *:09, *:23, *:45, and *:57hours: "*"# Any hour is validweekday: "1,3,6"# Run on Mondays, Wednesdays, and Saturdaysmonth: "1"# Run during January

Security

CrabbyLoop 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.

Development

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.

Automated Testing

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.

AI

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.

About

Run tasks on a schedule. Meant for use in containers as a process running alongside the main container process.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages