From 2e4058b147e302d7dcb9a722a93284bb3e46eeb7 Mon Sep 17 00:00:00 2001 From: vincent Date: Sat, 12 Jan 2019 14:36:49 +0100 Subject: [PATCH] add check services --- script/script/check_service.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 script/script/check_service.sh diff --git a/script/script/check_service.sh b/script/script/check_service.sh new file mode 100755 index 0000000..1a28ede --- /dev/null +++ b/script/script/check_service.sh @@ -0,0 +1,14 @@ +SERVICES=("mariadb" "nginx" "php-fpm" "gitea" "tt-rss" "named" "autofs" "rsyncd") +HOST=$(hostname) + +echo "device $HOST have reboot curent status of critic service:" +for service in ${SERVICES[@]} +do + status=$(systemctl is-active $service) + echo "$service is $status" + if [ $status = "inactive" ] + then + echo $(journalctl -u $service --lines=10 ) + fi + +done