update ubus-status.sh
This commit is contained in:
@@ -13,13 +13,10 @@ check_ubus() {
|
||||
fi
|
||||
|
||||
if [ "$(pgrep ubusd | wc -l)" -eq 0 ]; then
|
||||
sleep 1
|
||||
/sbin/ubusd &
|
||||
fi
|
||||
|
||||
if [ "$(pgrep rpcd | wc -l)" -eq 0 ] && [ "$(pgrep ubusd | wc -l)" -eq 1 ]; then
|
||||
/sbin/rpcd -s /var/run/ubus/ubus.sock -t 30 &
|
||||
fi
|
||||
|
||||
local datetime=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
local dbus_status=$(/etc/init.d/dbus status 2>&1)
|
||||
local status_code=$(curl -o /dev/null -s -w "%{http_code}\n" http://127.0.0.1/cgi-bin/luci/ 2>/dev/null)
|
||||
@@ -27,7 +24,11 @@ check_ubus() {
|
||||
status_code="ERROR"
|
||||
fi
|
||||
|
||||
if [[ "$status_code" == 500 || "$status_code" == 502 ]] && echo "$dbus_status" | grep -q "running"; then
|
||||
if [ "$(pgrep rpcd | wc -l)" -eq 0 ] && [ "$(pgrep ubusd | wc -l)" -eq 1 ]; then
|
||||
echo "$datetime / Ubus服务异常,正在重启Ubus。"
|
||||
sleep 1
|
||||
/sbin/rpcd -s /var/run/ubus/ubus.sock -t 30 &
|
||||
elif [[ "$status_code" == 500 || "$status_code" == 502 ]] && echo "$dbus_status" | grep -q "running"; then
|
||||
echo "$datetime / Ubus服务异常,正在重启Ubus。"
|
||||
killall rpcd
|
||||
sleep 1
|
||||
|
||||
Reference in New Issue
Block a user