aboutsummaryrefslogtreecommitdiff
path: root/kolla/docker/base/healthcheck_filemod
diff options
context:
space:
mode:
Diffstat (limited to 'kolla/docker/base/healthcheck_filemod')
-rwxr-xr-xkolla/docker/base/healthcheck_filemod15
1 files changed, 15 insertions, 0 deletions
diff --git a/kolla/docker/base/healthcheck_filemod b/kolla/docker/base/healthcheck_filemod
new file mode 100755
index 000000000..007643d9b
--- /dev/null
+++ b/kolla/docker/base/healthcheck_filemod
@@ -0,0 +1,15 @@
+#!/bin/bash
+file_path=$1
+limit_seconds=$2
+
+# if the file doesn't exist, return 1
+if [ ! -f $file_path ]; then
+ echo "${file_path} does not exist for file modification check"
+ exit 1
+fi
+curr_time=$(date +%s)
+last_mod=$(stat -c '%Y' $file_path)
+limit_epoch=$(( curr_time-limit_seconds ))
+if [ ${limit_epoch} -gt ${last_mod} ]; then
+ exit 1
+fi