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.defaults/init/8021x-client.conf
description "Syno 802.1X daemon"
author "Advanced Network Team"

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

instance $IFACE
env TEST=false

console log

respawn
respawn limit 5 10

pre-start script
	/bin/echo "==================== start 802.1X ====================" || true
end script

script
	exec /usr/sbin/wpa_supplicant -Dwired -c /usr/syno/etc/wpa_supplicant.conf.$IFACE -i $IFACE -qq -P /var/run/wpa_supplicant.pid.$IFACE
end script

post-start script
	if [ "$TEST" = "false" ]; then
		if /usr/syno/bin/synobootseq --is-booting-up ; then
			/bin/sleep 2 || true
		else
			time=1;
			/bin/sleep 1 || true
			while true; do
				if [ "$time" -ge "10" ]; then
					break;
				fi

				eapState=`/usr/sbin/wpa_cli -i $IFACE status | grep "EAP state" | sed 's/\=/ /g' | awk '{ printf $3 }'`

				if [ "x${eapState}" = "xSUCCESS" -o "x${eapState}" = "xFAILURE" ]; then
					break;
				fi

				/bin/sleep 3 || true
				time=$(($time + 3))
			done
		fi

		master=`get_key_value /etc/sysconfig/network-scripts/ifcfg-$IFACE MASTER` || true
		if [ -z "$master" ]; then
			restart dhcp-client IFACE=$IFACE
		fi
	fi
end script

# vim:ft=upstart