2017-09-27 05:16:43 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
RETRIES="{{ handler_health_nfs_check_retries }}"
|
|
|
|
DELAY="{{ handler_health_nfs_check_delay }}"
|
2021-03-03 22:43:50 +08:00
|
|
|
NFS_NAME="ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_facts['hostname']) }}"
|
2017-09-27 05:16:43 +08:00
|
|
|
PID=/var/run/ganesha.pid
|
2017-09-28 00:22:15 +08:00
|
|
|
{% if containerized_deployment %}
|
2021-03-03 22:43:50 +08:00
|
|
|
DOCKER_EXEC="{{ container_binary }} exec ceph-nfs-{{ ceph_nfs_service_suffix | default(ansible_facts['hostname']) }}"
|
2017-09-28 00:22:15 +08:00
|
|
|
{% endif %}
|
2017-09-27 05:16:43 +08:00
|
|
|
|
|
|
|
# First, restart the daemon
|
|
|
|
{% if containerized_deployment -%}
|
2017-10-04 19:09:43 +08:00
|
|
|
systemctl restart $NFS_NAME
|
2017-09-27 05:16:43 +08:00
|
|
|
# Wait and ensure the pid exists after restarting the daemon
|
|
|
|
while [ $RETRIES -ne 0 ]; do
|
2017-09-28 00:22:15 +08:00
|
|
|
$DOCKER_EXEC test -f $PID && exit 0
|
2017-09-27 05:16:43 +08:00
|
|
|
sleep $DELAY
|
|
|
|
let RETRIES=RETRIES-1
|
|
|
|
done
|
|
|
|
# If we reach this point, it means the pid is not present.
|
2018-11-27 17:45:05 +08:00
|
|
|
echo "PID file ${PID} could not be found, which means Ganesha is not running. Showing $NFS_NAME unit logs now:"
|
|
|
|
journalctl -u $NFS_NAME
|
2017-09-27 05:16:43 +08:00
|
|
|
exit 1
|
|
|
|
{% else %}
|
|
|
|
systemctl restart nfs-ganesha
|
|
|
|
{% endif %}
|