79851d7929
blueprint container-health-check Now docker supports healthcheck directive[0] in Dockerfile, which is helpful for checking container aliveness. Base for this patch were healthcheck scripts from tripleo[1]. [0] https://docs.docker.com/engine/reference/builder/#healthcheck [1] https://github.com/openstack/tripleo-common/tree/master/healthcheck Change-Id: Ifc32713cd4d6b45c74855c0ebf5bb65784701d44
16 lines
350 B
Bash
Executable File
16 lines
350 B
Bash
Executable File
#!/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
|