File: //usr/syno/lib/systemd/scripts/syslog-notify.sh
#!/bin/bash
IsLogCenterPkgActive() {
local status
status=$(/usr/syno/bin/synosystemctl get-active-status pkgctl-LogCenter)
if [ "$status" = "active" ] || [ "$status" = "activating" ];then
return 0
fi
return 1
}
Start() {
local isPkg=false
if IsLogCenterPkgActive ;then
isPkg=true
fi
/usr/syno/syslog/scripts/service/syslog_main.sh notification confclr
if [ "$isPkg" = "true" ];then
echo "ready to start syslog-notify for package"
/var/packages/LogCenter/target/service/scripts/syslog_main.sh notification confgen
else
echo "ready to start syslog-notify for DSM"
/usr/syno/syslog/scripts/service/syslog_main.sh notification confgen
fi
/usr/syno/sbin/synologconfgen
if [ "$isPkg" = "true" ];then
/usr/syno/bin/synosystemctl reload pkg-LogCenter-syslog
else
/usr/syno/bin/synosystemctl reload syslog-ng
fi
}
Stop() {
local isPkg=false
if IsLogCenterPkgActive ;then
isPkg=true
fi
if [ "$isPkg" = "true" ];then
/var/packages/LogCenter/target/service/scripts/syslog_main.sh notification confclr
else
/usr/syno/syslog/scripts/service/syslog_main.sh notification confclr
fi
if ! /usr/syno/bin/synobootseq --is-shutdown > /dev/null 2>&1 ; then
/usr/syno/sbin/synologconfgen
if [ "$isPkg" = "true" ];then
/usr/syno/bin/synosystemctl reload pkg-LogCenter-syslog
else
/usr/syno/bin/synosystemctl reload syslog-ng
fi
fi
}
case $1 in
--start)
Start
;;
--stop)
Stop
;;
esac