File: //usr/syno/lib/systemd/scripts/ups-plugout-notify.sh
#!/bin/sh
SYNOUPS_CONF="/usr/syno/etc/ups/synoups.conf"
UPS_NOTIFY="/lib/udev/script/synoupsnotify.sh"
SERVICE_RUNNING=`/usr/syno/bin/synogetkeyvalue $SYNOUPS_CONF ups_enabled`
PLUGIN_STATUS=`/usr/syno/bin/synosystemctl get-active-status ups-plugin-notify.service`
RESET_USB_STATUS=`/usr/syno/bin/synosystemctl get-active-status ups-reset-usb.service`
case "$1" in
start)
if [ "active" != "$RESET_USB_STATUS" ]; then
/usr/syno/bin/synologset1 sys warn 0x11300018
if [ "$SERVICE_RUNNING" == "yes" ]; then
$UPS_NOTIFY UPSDisconnect
fi
/usr/syno/bin/synosystemctl stop ups-plugin-notify.service
fi
;;
stop)
;;
restart)
;;
esac