New health check for cron containers
This tiny script ensures we: - have a crontab for a specified user - this crontab isn't empty If we don't pass a user, it defaults to root. The emptyness takes into account puppet comments, thus we count the lines without any leading '#'. By default, puppet adds some environment variables before the command itself, thus we want to have at least 2 uncommented lines. Change-Id: I8ee23f05a2925a20d003dd85b6095fd0b559a23a
This commit is contained in:
parent
3300af4827
commit
b6921c6e96
10
healthcheck/cron
Executable file
10
healthcheck/cron
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
file="${1:-root}"
|
||||
if [ -f /var/spool/cron/${file} ]; then
|
||||
nb_lines=$(grep -cEv '^#' /var/spool/cron/${file})
|
||||
if [ $nb_lines -ge 2 ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
exit 1
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
features:
|
||||
- new health check for "cron" containers, ensuring it exists and has content
|
Loading…
Reference in New Issue
Block a user