HEX
Server: Apache/2.2.34 (Unix) mod_fastcgi/mod_fastcgi-SNAP-0910052141
System: Linux Kou-Etsu-Dou 4.4.59+ #25556 SMP PREEMPT Thu Mar 4 18:03:46 CST 2021 x86_64
User: hosam (1026)
PHP: 7.2.29
Disabled: NONE
Upload Files
File: //etc/init/poweroff.conf
description	"Synology poweroff"

start on runlevel 0 and stopped umount-root-fs and umount-root-ok
stop on runlevel [!0]

task

console none

script
	## make sure runlevel is not 6 (reboot)
	run_level=`runlevel | awk '{ printf $2 }'` || true
	if [ "x${run_level}" = "x6" ]; then
		echo "incorrect runlevel, skip poweroff"
		exit 0
	fi

	if [ "$INIT_HALT" = "" ]; then
		INIT_HALT=POWEROFF
	fi

	# If INIT_HALT=HALT don't poweroff.
	poweroff="-p"
	if [ "$INIT_HALT" = "HALT" ]; then
		poweroff=""
	fi

	if /bin/get_key_value /etc.defaults/synoinfo.conf unique | /bin/grep broadwellntb; then
		/sbin/ifconfig ntb_eth0 down || true
	fi

	halt -f $poweroff

end script
# vim:ft=upstart