File: //etc/init/syno_poweroff_task.conf
description "Synology custom poweroff task"
start on runlevel [06]
stop on runlevel [!06]
task
console output
env PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin
script
if [ "$RUNLEVEL" = 0 ]; then
if [ "$INIT_HALT" != "HALT" ]; then
# poweroff
echo "System is going to poweroff."
/usr/bin/logger -p err -t syno_poweroff_task "System is acting poweroff."
/usr/syno/bin/syno_poweroff_task -p > /dev/null 2>&1
fi
else
# reboot
echo "System is going to reboot."
/usr/bin/logger -p err -t syno_poweroff_task "System is acting reboot."
/usr/syno/bin/syno_poweroff_task -r > /dev/null 2>&1
fi
end script
# vim:ft=upstart