0
如何以編程方式檢查應用程序中頁面的狀態?我希望能夠重新啓動服務器,如果我收到404
。是否可以自動執行此操作,以15秒爲間隔檢查頁面狀態?Ubuntu:用於檢查頁面狀態並重啓後的腳本
如何以編程方式檢查應用程序中頁面的狀態?我希望能夠重新啓動服務器,如果我收到404
。是否可以自動執行此操作,以15秒爲間隔檢查頁面狀態?Ubuntu:用於檢查頁面狀態並重啓後的腳本
像
#! /bin/bash
while true; do
curl --fail --silent http://localhost/your.page >/dev/null
if [[ $? -eq 22 ]]; then
sudo reboot
fi
sleep 15
done
東西檢查curl man page更多細節
我怎麼能編譯爲使其工作代碼? –
這是bash。無需編譯 –
非常感謝! –