Created
July 29, 2018 08:49
-
-
Save RoelAdriaans/6e5371c2fba1d61cbbd2594d767b13ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
lines=`journalctl -u gitlab-runner --since "30 minutes ago" | wc -l` | |
echo "Number of lines in jogfile: $lines" | |
if [ "$lines" -le 1 ]; then | |
uptime=`awk '{print $0/60;}' /proc/uptime` | |
if [ $(echo "$uptime > 20" | bc) -ne 0 ]; then | |
echo "We have less than one line and uptime is 20 minutes; shutting server down!" | |
else | |
echo "Uptime is less then 20 minutes, only $uptime" | |
fi | |
else | |
echo "More then one line; doing nothing" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment