forked from troykinsella/ansible-concourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
concourse-worker: add watchdog process
- Loading branch information
Steve Durrheimer
committed
Jun 4, 2020
1 parent
fb0f13c
commit 03ea310
Showing
6 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
# {{ ansible_managed }} | ||
|
||
export NOTIFY_SOCKET=/run/systemd/notify | ||
|
||
while(true); do | ||
FAIL=0 | ||
|
||
WORKER_PID=$(systemctl show -p MainPID concourse-worker.service 2>/dev/null | cut -d= -f2) | ||
if [[ $WORKER_PID -eq 0 ]]; then | ||
echo "can't get concourse-worker systemd MainPID: service is not running" | ||
sleep 1 | ||
continue | ||
fi | ||
|
||
curl --silent 127.0.0.1:8888 || FAIL=1 | ||
|
||
if [[ $FAIL -eq 0 ]]; then | ||
/bin/systemd-notify --pid=$WORKER_PID "WATCHDOG=1" | ||
sleep $(({{ concourse_worker_watchdog_sec }} / 2)) | ||
else | ||
echo "concourse-worker healthcheck failed" | ||
sleep 1 | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# {{ ansible_managed }} | ||
|
||
[Unit] | ||
Description=concourse-worker-watchdog | ||
BindsTo=concourse-worker.service | ||
|
||
[Service] | ||
ExecStart={{ concourse_worker_watchdog_path }} | ||
Restart=on-failure | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters