shell httpd監控指令碼

2021-09-05 11:58:00 字數 1410 閱讀 6734

#!/bin/bash

while true

do echo -e "

\033[31m start 開啟httpd服務 \033[0m

\033[32m stop 關閉httpd服務 \033[0m

\033[33m restart 重啟httpd服務 \033[0m

\033[34m status 檢視httpd服務 \033[0m

\033[35m quit 退出 \033[0m

"read -p "請輸入你的選擇:" char

echo -e "\033[31m httpd開啟成功!\033[0m"

elif [ $state == "(running)" ]; then

echo -e "\033[31m httpd已經處於開啟狀態!\033[0m"

fi;;

stop)

if [ $state == "(dead)" ]; then

echo -e "\033[31m httpd已經處於關閉狀態!\033[0m"

echo -e "\033[31m httpd關閉成功!\033[0m"

fi;;

restart)

if [ $state == "(dead)" ]; then

echo -e "\033[31m httpd處於關閉狀態,請先輸入「start」開啟服務!\033[0m"

echo -e "\033[31m httpd重啟成功!\033[0m"

fi;;

status)

if [ $state == "(dead)" ]; then

echo -e "\033[31m httpd處於關閉狀態!\033[0m"

elif [ $state == "(running)" ]; then

echo -e "\033[31m httpd處於開啟狀態!\033[0m"

fi;;

quit)

exit 0

;;esac

done

SHELL httpd監控指令碼

033 31m start 開啟httpd服務 033 0m 033 32m stop 關閉httpd服務 033 0m 033 33m status 檢視httpd服務狀態 033 0m 033 34m restart 重啟httpd服務 033 0m 033 35m q 退出系統 033 0m ...

mysql 監控指令碼 監控mysql狀態指令碼

監控mysql狀態,發現宕後,自動重啟,每秒檢查一次。check.sh bin bash while true do bin sleep 1 sh mysql status.sh done chengkill bin sh pid kill thread for chenglee if filefo...

Linux CPU 監控指令碼

下面是乙個簡單的cpu監控指令碼,當然還可以在進行全面考慮公升級該指令碼。bin sh gt 60 伺服器只有乙個cpu scriptdir root shell cpu jk 目錄存放 logdir scriptdir log 日誌檔案存放及目錄建立 清理 if d logdir then ech...