mirror of https://github.com/OpenIPC/firmware.git
add SOC check
parent
e9deec75a9
commit
892431444f
|
@ -2,22 +2,34 @@
|
|||
|
||||
DAEMON="watchdog"
|
||||
|
||||
WATCHDOG_VENDOR=$(ipcinfo -v)
|
||||
WATCHDOG_ENABLED=false
|
||||
WATCHDOG_TIMEOUT=60
|
||||
WATCHDOG_ARGS="-T $WATCHDOG_TIMEOUT /dev/watchdog"
|
||||
SUPPORTED_VENDORS="ingenic"
|
||||
|
||||
vendor_supported() {
|
||||
for vendor in $SUPPORTED_VENDORS; do
|
||||
[ "$WATCHDOG_VENDOR" = "$vendor" ] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
[ "$(cli -g .watchdog.enabled)" = "false" ] && [ "$WATCHDOG_ENABLED" = "true" ] || { echo "Watchdog: Majestic Watchdog is enabled or standalone watchdog disabled"; exit 0; }
|
||||
|
||||
printf "Starting ${NAME}: "
|
||||
start-stop-daemon -S -q -x "/sbin/${DAEMON}" -- ${WATCHDOG_ARGS}
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
if vendor_supported && [ "$(cli -g .watchdog.enabled)" = "false" ] && [ "$WATCHDOG_ENABLED" = "true" ]; then
|
||||
printf "Starting ${DAEMON}: "
|
||||
start-stop-daemon -S -q -x "/sbin/${DAEMON}" -- ${WATCHDOG_ARGS}
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
else
|
||||
echo "Watchdog: Unsupported vendor or Majestic Watchdog is enabled/standalone watchdog disabled"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
printf "Stopping ${NAME}: "
|
||||
printf "Stopping ${DAEMON}: "
|
||||
if start-stop-daemon -K -q -s KILL -n "${DAEMON}"; then
|
||||
echo "OK"
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue