Introducing JobMonkey

Instead of writing a bash script for automating a recurring job I decided to write a general purpose job executor in Python this time.

The idea was to define recurring jobs (for backup, update checks, etc.) in a config file, which can be executed by name. The jobs will then be called via Cron or Systemd once per day (or any other interval).

Also I wanted to be informed about the outcome of some jobs. But instead of filling up my mailbox I prefer to receive the notifications on my phone via Telegram.

So I ended up writing JobMonkey 🙂 You can find the source on Github.

Jobs consist of one or more tasks. Where each task is a command to be executed.


  • Configuration is stored in a YAML file.
  • Jobs can be enabled or disabled.
  • Job based reporting can be enabled ‘always’ or ‘on-failure’
  • Reporting can also be enabled for single tasks
  • Reports are sent via Telegram

The config YAML looks like this:

  user: root
      chat_id: '0000000000'

  - name: test
    enabled: false
      - type: telegram
        when: on-failue
      - run: "hostname -f"
        report: true
      - run: "false"
        report: false

  - name: upgrade-check
    descr: "Check for security updates"
    enabled: true
      - type: telegram
        when: always
      - run: "apt update"
      - run: "/usr/local/sbin/"
        report: true


# jobmonkey -h
usage: jobmonkey [-h] {list,run} ...

Jobmonkey - runs jobs and sends reports

optional arguments:
  -h, --help  show this help message and exit

valid actions:
    list      List jobs
    run       Run one or more jobs

Listing defined jobs:

# jobmonkey list
| Job name                | Enabled |
| test                    | False   |
| upgrade-check           | True    |
| backup-dump-database    | True    |
| backup-local-disk       | True    |
| backup-remote-backblaze | True    |

Listing defined jobs:

# jobmonkey run upgrade-check -v
processing job: '{'name': 'upgrade-check', 'enabled': True, 'reports': [{'type': 'telegram', 'when': 'always'}], 'tasks': [{'run': 'apt update'}, {'run': '/usr/local/sbin/', 'report': True}]}'
  processing report 'telegram'

Example report:

Job upgrade-check finished with 0 error(s).

 Result from '/usr/local/sbin/': 'Security upgrades: 2
 Total upgrades: 6

 List of security upgrades:

Leave a Comment