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: //usr/share/init/bluetoothd.conf
description "Bluez daemon"

author "Advanced Network Team"

# do not start on anything
stop on runlevel [06]

console log
expect fork
respawn
respawn limit 5 10

pre-start script
	/bin/date
	echo "start bluetoothd"
end script

exec /usr/sbin/bluetoothd

post-start script
	echo "going to start btacd"
	/usr/syno/sbin/synoservicectl --start btacd
end script

pre-stop script
	/usr/syno/sbin/synoservicectl --stop btacd
end script

post-stop script
	counter=`ls -al ${BLUETOOTH_INFO}* | wc -l`
	hcitable=`/usr/bin/hciconfig | grep hci | sed 's/\:/ /g' | awk '{print $1}' | sort -u`

	if [ ${counter} -eq 0 ]; then
		echo "Try to down ${hcitable}"
		for hci in ${hcitable}; do
			if [ "x${hci}" != "x" ]; then
				echo "try to remove ${hci} "
				`/usr/bin/hciconfig ${hci} down`
			fi
		done
	fi
end script

# vim:ft=upstart