track if cron is running and try to restart on failure
This commit is contained in:
Родитель
bbfc42f23e
Коммит
6a94437881
|
@ -86,6 +86,19 @@ while true; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
start_cron () {
|
||||||
|
echo "Starting cron ..."
|
||||||
|
if $CLUSTER; then
|
||||||
|
if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start"; then
|
||||||
|
echo "* Warning: Failed to start cron on one or more nodes"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start"; then
|
||||||
|
echo "* Warning: Failed to start cron"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
cleanup () {
|
cleanup () {
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
update_restore_status "$1"
|
update_restore_status "$1"
|
||||||
|
@ -103,6 +116,10 @@ cleanup () {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! $CRON_RUNNING; then
|
||||||
|
start_cron
|
||||||
|
fi
|
||||||
|
|
||||||
# Cleanup SSH multiplexing
|
# Cleanup SSH multiplexing
|
||||||
ghe-ssh --clean
|
ghe-ssh --clean
|
||||||
}
|
}
|
||||||
|
@ -249,6 +266,7 @@ update_restore_status () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CRON_RUNNING=true
|
||||||
# Update remote restore state file and setup failure trap
|
# Update remote restore state file and setup failure trap
|
||||||
trap "cleanup failed" EXIT
|
trap "cleanup failed" EXIT
|
||||||
update_restore_status "restoring"
|
update_restore_status "restoring"
|
||||||
|
@ -324,7 +342,7 @@ else
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
CRON_RUNNING=false
|
||||||
|
|
||||||
# Restore settings and license if restoring to an unconfigured appliance or when
|
# Restore settings and license if restoring to an unconfigured appliance or when
|
||||||
# specified manually.
|
# specified manually.
|
||||||
|
@ -492,16 +510,8 @@ if ! $RESTORE_SETTINGS; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start cron. Timerd will start automatically as part of the config run.
|
# Start cron. Timerd will start automatically as part of the config run.
|
||||||
echo "Starting cron ..."
|
start_cron
|
||||||
if $CLUSTER; then
|
CRON_RUNNING=true
|
||||||
if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start"; then
|
|
||||||
echo "* Warning: Failed to start cron on one or more nodes"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start"; then
|
|
||||||
echo "* Warning: Failed to start cron"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Clean up all stale replicas on configured instances.
|
# Clean up all stale replicas on configured instances.
|
||||||
if ! $CLUSTER && $instance_configured; then
|
if ! $CLUSTER && $instance_configured; then
|
||||||
|
|
Загрузка…
Ссылка в новой задаче