Make a nicer little monitoring script
This commit is contained in:
parent
7925cfdbc2
commit
aec4090018
26
on-ping-service-failure.sh
Executable file
26
on-ping-service-failure.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# I am potentially invoked when ping-service.sh (which see) fails to
|
||||
# contact the racket-pkg-website service.
|
||||
#
|
||||
|
||||
# Request a dump of running threads:
|
||||
touch $HOME/racket-pkg-website/signals/.dumpinfo
|
||||
|
||||
# Wait a few seconds for the dump to complete:
|
||||
sleep 10
|
||||
|
||||
# Tar up the most recent few hours' worth of logs:
|
||||
logarchive=$HOME/ping-failure-logs-$(date +%Y%m%d%H%M%S).tar.gz
|
||||
(
|
||||
cd $HOME/service/racket-pkg-website/log/main/; \
|
||||
ls -tr | tail -n 10 | xargs tar -zcf $logarchive \
|
||||
)
|
||||
|
||||
# Restart the service using daemontools:
|
||||
svc -du $HOME/service/racket-pkg-website
|
||||
|
||||
# Finally, complain out loud. We expect to be running in some kind of
|
||||
# cron-ish context, so the output we produce here will likely find its
|
||||
# way into an email to a responsible party.
|
||||
echo "racket-pkg-website on-ping-service-failure.sh invoked. logarchive=$logarchive"
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
# For example, to monitor racket-pkg-website, try
|
||||
#
|
||||
# ./ping-service.sh https://localhost:8444/ping 'touch .../signals/.dumpinfo; sleep 10; svc -du ...'
|
||||
# ./ping-service.sh https://localhost:8444/ping $HOME/racket-pkg-website/on-ping-service-failure.sh
|
||||
|
||||
if [ "$#" != "2" ]
|
||||
then
|
||||
|
|
Loading…
Reference in New Issue
Block a user