Check Cronstatus

Script: check_cronstatus

Show status of all Cronjobs using Axels Cronwrapper

check_cronstatus executes the cronstatus.sh in the cronwrapper installation directory and will parse its output.

In the cronstatus the last run of each job will be verified with these conditions:

  • exitcode was 0
  • last run is younger than given TTL

As output you get a summary of all checks followed by more detailed status per job.

Requirements

  • Axels Cronwrapper must be installed
  • Your cronjob(s) must be changed to use the wrapper, eg.
    */60 * * * * /opt/cronwrapper/cronwrapper.sh 60 <YOUR_COMMAND>

📄 Source: https://github.com/axelhahn/cronwrapper
📜 License: GNU GPL 3.0
📗 Docs: see docs folder or online https://www.axel-hahn.de/docs/cronwrapper/

Standalone installation

From this repository you need next to this script:

  • inc_pluginfunctions shared function for all IML checks written in bash

Syntax

______________________________________________________________________

CHECK_CRONSTATUS
v2.6

(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3

https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_cronstatus.html
______________________________________________________________________

Show status of all Cronjobs using Axels Cronwrapper
https://github.com/axelhahn/cronwrapper

The last run of each job is verified to these conditions:
- exitcode was 0
- last run is younger than given TTL


SYNTAX:
check_cronstatus [-h] [SCRIPT]

OPTIONS:

    -h or --help   show this help.

PARAMETERS:

    SCRIPT         optional: custom status script
                   default: /opt/cronwrapper/cronstatus.sh

Examples

check_cronstatus The Check of cronjobs with the default loction does not require any parameter

check_cronstatus /usr/share/cronwrapper/cronstatus.sh The Check of cronjobs with custom loction. The parameter must reference cronstatus.sh with its full path

Output example with 2 cronjobs

./check_cronstatus
CRITICAL: Cronjob status JOBS: 2 .. RUNNING: 0 .. ERRORS: 1
(CRITICAL) os-update
OK iml-backup
______________________________________________________________________________


  AXELS CRONWRAPPER
  Jobstatus of cronjobs on axels-laptop
                                                                         v 2.8
______________________________________________________________________________

..... (CRITICAL): os-update

    Command   : /home/axel/skripte/topgrade-wrapper/start_topgrade.sh
    Last start: 2026-03-05 13:30:48, 1772713848
    Returncode: 1 <<<<<<<<<< (ERROR): non zero exit code

        Last lines in output:
        uv: OK
        
        Pacman backup configuration files found:
        /etc/pam.d/kde.pacnew
        /etc/pam.d/kde.pacsave
        /etc/nginx/nginx.conf.pacnew
        /etc/makepkg.conf.d/fortran.conf.pacnew
        /etc/makepkg.conf.d/rust.conf.pacnew
        /etc/libvirt/nwfilter/clean-traffic-gateway.xml.pacnew
        /etc/libvirt/nwfilter/clean-traffic.xml.pacnew
        /etc/libvirt/nwfilter/qemu-announce-self-rarp.xml.pacnew
        /etc/libvirt/nwfilter/qemu-announce-self.xml.pacnew
        /etc/php/php.ini.pacnew
        /etc/hosts.pacnew
        /etc/passwd.pacnew
        /etc/shells.pacnew
        /etc/pacman-mirrors.conf.pacnew
        /etc/pacman.conf.pacnew
        /etc/locale.gen.pacnew
        /etc/mkinitcpio.conf.pacnew

    Duration  : 39 s
    Ttl       : 1440 - 24 h OK
    Expires   : 1772803848 2026-03-06 14:30:48 OK

    Logfile   : /var/tmp/cronlogs/axels-laptop_os-update.log

    Last executions:

        Result      Start time             rc    Execution time
        ---------   -------------------   ---   ---------------
        ERROR       2026-03-05 13:30:48     1             39 s
        ERROR       2026-03-05 08:50:00     1             36 s
        ERROR       2026-03-04 12:50:00     1             24 s
        ERROR       2026-03-04 08:50:00     1             27 s
        ERROR       2026-03-03 12:50:00     1             25 s
        ERROR       2026-03-03 08:50:00     1             25 s
        ERROR       2026-03-02 12:50:00     1             17 s
        ERROR       2026-03-02 08:50:00     1             16 s
        ERROR       2026-02-27 12:50:00     1             21 s
        ERROR       2026-02-27 08:50:00     1             15 s

..... (OK): iml-backup

    Command   : /home/axel/skripte/client/backup.sh
    Last start: 2026-03-05 12:12:00, 1772709120
    Returncode: 0 OK
    Duration  : 650 s
    Ttl       : 1440 - 24 h OK
    Expires   : 1772799120 2026-03-06 13:12:00 OK

    Logfile   : /var/tmp/cronlogs/axels-laptop_iml-backup.log

    Last executions:

        Result      Start time             rc    Execution time
        ---------   -------------------   ---   ---------------
        OK          2026-03-05 12:12:00     0            650 s
        OK          2026-03-05 09:12:00     0            292 s
        OK          2026-03-04 15:12:00     0            280 s
        OK          2026-03-04 12:12:00     0            238 s
        OK          2026-03-04 09:12:00     0            276 s
        OK          2026-03-03 15:12:00     0            325 s
        OK          2026-03-03 12:12:00     0            345 s
        OK          2026-03-03 09:12:00     0            350 s
        OK          2026-03-02 21:12:00     0            314 s
        OK          2026-03-02 15:12:00     0            226 s

There is no running job.
______________________________________________________________________________
JOBS: 2 .. RUNNING: 0 .. ERRORS: 1