Skip to content

Commit

Permalink
PAD-156: Add custom health check script
Browse files Browse the repository at this point in the history
  • Loading branch information
oz123 committed Oct 18, 2023
1 parent 7b41a6c commit a18f456
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ FROM $BASE
### To install the nginx package for opensuse ###

#RUN zypper refresh && zypper install nginx -y

# Add custom health check for two-node liveness

# ADD overlay/files/opt/spectrocloud/bin/check-disk-size.sh /opt/spectrocloud/bin/
15 changes: 15 additions & 0 deletions overlay/files/opt/spectrocloud/bin/check-disk-size.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

REQUIRED_FREE_DISK=$1

FREE=$(df -h --output=pcent /var/ | tail -n 1 | tr -d '\% ')

if (( $FREE < $REQUIRED_FREE_DISK )); then
echo "Not enough free disk, required: $1. Free: $FREE"
exit 1
fi

echo "Free disk ok, required: $1. Free: $FREE"
exit 0

0 comments on commit a18f456

Please sign in to comment.