add SOC check

pull/1191/head
gtxaspec 2023-12-10 07:43:52 -08:00
parent e9deec75a9
commit 892431444f
1 changed files with 18 additions and 6 deletions

View File

@ -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