ceph-ansible/roles/ceph-defaults/templates/restart_nfs_daemon.sh.j2

27 lines
752 B
Django/Jinja

#!/bin/bash
RETRIES="{{ handler_health_nfs_check_retries }}"
DELAY="{{ handler_health_nfs_check_delay }}"
NFS_NAME="{{ ansible_hostname }}"
PID=/var/run/ganesha.pid
{% if containerized_deployment %}
DOCKER_EXEC="docker exec ceph-nfs-{{ ansible_hostname }}"
{% endif %}
# First, restart the daemon
{% if containerized_deployment -%}
systemctl restart ceph-nfs@${NFS_NAME}
COUNT=10
# Wait and ensure the pid exists after restarting the daemon
while [ $RETRIES -ne 0 ]; do
$DOCKER_EXEC test -f $PID && exit 0
sleep $DELAY
let RETRIES=RETRIES-1
done
# If we reach this point, it means the pid is not present.
echo "PID file ${PID} could not be found, which means Ganesha is not running."
exit 1
{% else %}
systemctl restart nfs-ganesha
{% endif %}