mirror of https://github.com/OpenIPC/firmware.git
				
				
				
			Add reload to S95{platform}
							parent
							
								
									2ef19d1ee2
								
							
						
					
					
						commit
						8c1e39871e
					
				|  | @ -8,6 +8,21 @@ DAEMON_ARGS="-s" | ||||||
| # shellcheck source=/dev/null | # shellcheck source=/dev/null | ||||||
| [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | ||||||
| 
 | 
 | ||||||
|  | load_majestic() { | ||||||
|  | 	printf 'Starting %s: ' "$DAEMON" | ||||||
|  | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
|  | 	# shellcheck disable=SC2086 # we need the word splitting | ||||||
|  | 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ | ||||||
|  | 		-- $DAEMON_ARGS | ||||||
|  | 	status=$? | ||||||
|  | 	if [ "$status" -eq 0 ]; then | ||||||
|  | 		echo "OK" | ||||||
|  | 	else | ||||||
|  | 		echo "FAIL" | ||||||
|  | 	fi | ||||||
|  | 	return "$status" | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | ||||||
| start() { | start() { | ||||||
| 	logger -s -p daemon.info -t goke "Check MAC for Xiongmai devices" | 	logger -s -p daemon.info -t goke "Check MAC for Xiongmai devices" | ||||||
|  | @ -22,24 +37,13 @@ start() { | ||||||
| 	export TZ=$(cat /etc/TZ) | 	export TZ=$(cat /etc/TZ) | ||||||
| 	load_goke -i | 	load_goke -i | ||||||
| 	# | 	# | ||||||
| 	printf 'Starting %s: ' "$DAEMON" |   load_majestic | ||||||
| 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " |  | ||||||
| 	# shellcheck disable=SC2086 # we need the word splitting |  | ||||||
| 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ |  | ||||||
| 		-- $DAEMON_ARGS |  | ||||||
| 	status=$? |  | ||||||
| 	if [ "$status" -eq 0 ]; then |  | ||||||
| 		echo "OK" |  | ||||||
| 	else |  | ||||||
| 		echo "FAIL" |  | ||||||
| 	fi |  | ||||||
| 	return "$status" |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| stop() { | stop() { | ||||||
| 	printf 'Stopping %s: ' "$DAEMON" | 	printf 'Stopping %s: ' "$DAEMON" | ||||||
| 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
| 	start-stop-daemon -K -q -p "$PIDFILE" | 	start-stop-daemon -K -s 9 -q -p "$PIDFILE" | ||||||
| 	status=$? | 	status=$? | ||||||
| 	if [ "$status" -eq 0 ]; then | 	if [ "$status" -eq 0 ]; then | ||||||
| 		rm -f "$PIDFILE" | 		rm -f "$PIDFILE" | ||||||
|  | @ -56,12 +60,13 @@ restart() { | ||||||
| 	start | 	start | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | reload() { | ||||||
|  | 	load_majestic | ||||||
|  | } | ||||||
|  | 
 | ||||||
| case "$1" in | case "$1" in | ||||||
| 	start|stop|restart) | 	start|stop|restart|reload) | ||||||
| 		"$1";; | 		"$1";; | ||||||
| 	reload) |  | ||||||
| 		# Restart, since there is no true "reload" feature. |  | ||||||
| 		restart;; |  | ||||||
| 	*) | 	*) | ||||||
| 		echo "Usage: $0 {start|stop|restart|reload}" | 		echo "Usage: $0 {start|stop|restart|reload}" | ||||||
| 		exit 1 | 		exit 1 | ||||||
|  |  | ||||||
|  | @ -8,6 +8,21 @@ DAEMON_ARGS="-s" | ||||||
| # shellcheck source=/dev/null | # shellcheck source=/dev/null | ||||||
| [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | ||||||
| 
 | 
 | ||||||
|  | load_majestic() { | ||||||
|  | 	printf 'Starting %s: ' "$DAEMON" | ||||||
|  | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
|  | 	# shellcheck disable=SC2086 # we need the word splitting | ||||||
|  | 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ | ||||||
|  | 		-- $DAEMON_ARGS | ||||||
|  | 	status=$? | ||||||
|  | 	if [ "$status" -eq 0 ]; then | ||||||
|  | 		echo "OK" | ||||||
|  | 	else | ||||||
|  | 		echo "FAIL" | ||||||
|  | 	fi | ||||||
|  | 	return "$status" | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | ||||||
| start() { | start() { | ||||||
| 	logger -s -p daemon.info -t hisilicon "Check MAC for Xiongmai devices" | 	logger -s -p daemon.info -t hisilicon "Check MAC for Xiongmai devices" | ||||||
|  | @ -22,24 +37,13 @@ start() { | ||||||
| 	export TZ=$(cat /etc/TZ) | 	export TZ=$(cat /etc/TZ) | ||||||
| 	load_hisilicon -i | 	load_hisilicon -i | ||||||
| 	# | 	# | ||||||
| 	printf 'Starting %s: ' "$DAEMON" |   load_majestic | ||||||
| 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " |  | ||||||
| 	# shellcheck disable=SC2086 # we need the word splitting |  | ||||||
| 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ |  | ||||||
| 		-- $DAEMON_ARGS |  | ||||||
| 	status=$? |  | ||||||
| 	if [ "$status" -eq 0 ]; then |  | ||||||
| 		echo "OK" |  | ||||||
| 	else |  | ||||||
| 		echo "FAIL" |  | ||||||
| 	fi |  | ||||||
| 	return "$status" |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| stop() { | stop() { | ||||||
| 	printf 'Stopping %s: ' "$DAEMON" | 	printf 'Stopping %s: ' "$DAEMON" | ||||||
| 	[ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, " | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
| 	start-stop-daemon -K -q -p "$PIDFILE" | 	start-stop-daemon -K -s 9 -q -p "$PIDFILE" | ||||||
| 	status=$? | 	status=$? | ||||||
| 	if [ "$status" -eq 0 ]; then | 	if [ "$status" -eq 0 ]; then | ||||||
| 		rm -f "$PIDFILE" | 		rm -f "$PIDFILE" | ||||||
|  | @ -56,12 +60,13 @@ restart() { | ||||||
| 	start | 	start | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | reload() { | ||||||
|  | 	load_majestic | ||||||
|  | } | ||||||
|  | 
 | ||||||
| case "$1" in | case "$1" in | ||||||
| 	start|stop|restart) | 	start|stop|restart|reload) | ||||||
| 		"$1";; | 		"$1";; | ||||||
| 	reload) |  | ||||||
| 		# Restart, since there is no true "reload" feature. |  | ||||||
| 		restart;; |  | ||||||
| 	*) | 	*) | ||||||
| 		echo "Usage: $0 {start|stop|restart|reload}" | 		echo "Usage: $0 {start|stop|restart|reload}" | ||||||
| 		exit 1 | 		exit 1 | ||||||
|  |  | ||||||
|  | @ -3,11 +3,26 @@ | ||||||
| DAEMON="majestic" | DAEMON="majestic" | ||||||
| PIDFILE="/var/run/$DAEMON.pid" | PIDFILE="/var/run/$DAEMON.pid" | ||||||
| 
 | 
 | ||||||
| DAEMON_ARGS="" | DAEMON_ARGS="-s" | ||||||
| 
 | 
 | ||||||
| # shellcheck source=/dev/null | # shellcheck source=/dev/null | ||||||
| [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | ||||||
| 
 | 
 | ||||||
|  | load_majestic() { | ||||||
|  | 	printf 'Starting %s: ' "$DAEMON" | ||||||
|  | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
|  | 	# shellcheck disable=SC2086 # we need the word splitting | ||||||
|  | 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ | ||||||
|  | 		-- $DAEMON_ARGS | ||||||
|  | 	status=$? | ||||||
|  | 	if [ "$status" -eq 0 ]; then | ||||||
|  | 		echo "OK" | ||||||
|  | 	else | ||||||
|  | 		echo "FAIL" | ||||||
|  | 	fi | ||||||
|  | 	return "$status" | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | ||||||
| start() { | start() { | ||||||
| 	logger -s -p daemon.info -t hisilicon "Check MAC for Xiongmai devices" | 	logger -s -p daemon.info -t hisilicon "Check MAC for Xiongmai devices" | ||||||
|  | @ -22,24 +37,13 @@ start() { | ||||||
| 	export TZ=$(cat /etc/TZ) | 	export TZ=$(cat /etc/TZ) | ||||||
| 	load_hisilicon -i | 	load_hisilicon -i | ||||||
| 	# | 	# | ||||||
| 	printf 'Starting %s: ' "$DAEMON" |   load_majestic | ||||||
| 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " |  | ||||||
| 	# shellcheck disable=SC2086 # we need the word splitting |  | ||||||
| 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ |  | ||||||
| 		-- $DAEMON_ARGS |  | ||||||
| 	status=$? |  | ||||||
| 	if [ "$status" -eq 0 ]; then |  | ||||||
| 		echo "OK" |  | ||||||
| 	else |  | ||||||
| 		echo "FAIL" |  | ||||||
| 	fi |  | ||||||
| 	return "$status" |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| stop() { | stop() { | ||||||
| 	printf 'Stopping %s: ' "$DAEMON" | 	printf 'Stopping %s: ' "$DAEMON" | ||||||
| 	[ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, " | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
| 	start-stop-daemon -K -q -p "$PIDFILE" | 	start-stop-daemon -K -s 9 -q -p "$PIDFILE" | ||||||
| 	status=$? | 	status=$? | ||||||
| 	if [ "$status" -eq 0 ]; then | 	if [ "$status" -eq 0 ]; then | ||||||
| 		rm -f "$PIDFILE" | 		rm -f "$PIDFILE" | ||||||
|  | @ -56,12 +60,13 @@ restart() { | ||||||
| 	start | 	start | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | reload() { | ||||||
|  | 	load_majestic | ||||||
|  | } | ||||||
|  | 
 | ||||||
| case "$1" in | case "$1" in | ||||||
| 	start|stop|restart) | 	start|stop|restart|reload) | ||||||
| 		"$1";; | 		"$1";; | ||||||
| 	reload) |  | ||||||
| 		# Restart, since there is no true "reload" feature. |  | ||||||
| 		restart;; |  | ||||||
| 	*) | 	*) | ||||||
| 		echo "Usage: $0 {start|stop|restart|reload}" | 		echo "Usage: $0 {start|stop|restart|reload}" | ||||||
| 		exit 1 | 		exit 1 | ||||||
|  |  | ||||||
|  | @ -8,6 +8,21 @@ DAEMON_ARGS="-s" | ||||||
| # shellcheck source=/dev/null | # shellcheck source=/dev/null | ||||||
| [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | ||||||
| 
 | 
 | ||||||
|  | load_majestic() { | ||||||
|  | 	printf 'Starting %s: ' "$DAEMON" | ||||||
|  | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
|  | 	# shellcheck disable=SC2086 # we need the word splitting | ||||||
|  | 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ | ||||||
|  | 		-- $DAEMON_ARGS | ||||||
|  | 	status=$? | ||||||
|  | 	if [ "$status" -eq 0 ]; then | ||||||
|  | 		echo "OK" | ||||||
|  | 	else | ||||||
|  | 		echo "FAIL" | ||||||
|  | 	fi | ||||||
|  | 	return "$status" | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | ||||||
| start() { | start() { | ||||||
| 	logger -s -p daemon.info -t hisilicon "Check MAC for Xiongmai devices" | 	logger -s -p daemon.info -t hisilicon "Check MAC for Xiongmai devices" | ||||||
|  | @ -22,24 +37,13 @@ start() { | ||||||
| 	export TZ=$(cat /etc/TZ) | 	export TZ=$(cat /etc/TZ) | ||||||
| 	load_hisilicon -i | 	load_hisilicon -i | ||||||
| 	# | 	# | ||||||
| 	printf 'Starting %s: ' "$DAEMON" |   load_majestic | ||||||
| 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " |  | ||||||
| 	# shellcheck disable=SC2086 # we need the word splitting |  | ||||||
| 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ |  | ||||||
| 		-- $DAEMON_ARGS |  | ||||||
| 	status=$? |  | ||||||
| 	if [ "$status" -eq 0 ]; then |  | ||||||
| 		echo "OK" |  | ||||||
| 	else |  | ||||||
| 		echo "FAIL" |  | ||||||
| 	fi |  | ||||||
| 	return "$status" |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| stop() { | stop() { | ||||||
| 	printf 'Stopping %s: ' "$DAEMON" | 	printf 'Stopping %s: ' "$DAEMON" | ||||||
| 	[ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, " | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
| 	start-stop-daemon -K -q -p "$PIDFILE" | 	start-stop-daemon -K -s 9 -q -p "$PIDFILE" | ||||||
| 	status=$? | 	status=$? | ||||||
| 	if [ "$status" -eq 0 ]; then | 	if [ "$status" -eq 0 ]; then | ||||||
| 		rm -f "$PIDFILE" | 		rm -f "$PIDFILE" | ||||||
|  | @ -56,12 +60,13 @@ restart() { | ||||||
| 	start | 	start | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | reload() { | ||||||
|  | 	load_majestic | ||||||
|  | } | ||||||
|  | 
 | ||||||
| case "$1" in | case "$1" in | ||||||
| 	start|stop|restart) | 	start|stop|restart|reload) | ||||||
| 		"$1";; | 		"$1";; | ||||||
| 	reload) |  | ||||||
| 		# Restart, since there is no true "reload" feature. |  | ||||||
| 		restart;; |  | ||||||
| 	*) | 	*) | ||||||
| 		echo "Usage: $0 {start|stop|restart|reload}" | 		echo "Usage: $0 {start|stop|restart|reload}" | ||||||
| 		exit 1 | 		exit 1 | ||||||
|  |  | ||||||
|  | @ -8,6 +8,21 @@ DAEMON_ARGS="-s" | ||||||
| # shellcheck source=/dev/null | # shellcheck source=/dev/null | ||||||
| [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | ||||||
| 
 | 
 | ||||||
|  | load_majestic() { | ||||||
|  | 	printf 'Starting %s: ' "$DAEMON" | ||||||
|  | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
|  | 	# shellcheck disable=SC2086 # we need the word splitting | ||||||
|  | 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ | ||||||
|  | 		-- $DAEMON_ARGS | ||||||
|  | 	status=$? | ||||||
|  | 	if [ "$status" -eq 0 ]; then | ||||||
|  | 		echo "OK" | ||||||
|  | 	else | ||||||
|  | 		echo "FAIL" | ||||||
|  | 	fi | ||||||
|  | 	return "$status" | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | ||||||
| start() { | start() { | ||||||
| 	logger -s -p daemon.info -t hisilicon "Check MAC for Xiongmai devices" | 	logger -s -p daemon.info -t hisilicon "Check MAC for Xiongmai devices" | ||||||
|  | @ -22,24 +37,13 @@ start() { | ||||||
| 	export TZ=$(cat /etc/TZ) | 	export TZ=$(cat /etc/TZ) | ||||||
| 	load_hisilicon -i | 	load_hisilicon -i | ||||||
| 	# | 	# | ||||||
| 	printf 'Starting %s: ' "$DAEMON" |   load_majestic | ||||||
| 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " |  | ||||||
| 	# shellcheck disable=SC2086 # we need the word splitting |  | ||||||
| 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ |  | ||||||
| 		-- $DAEMON_ARGS |  | ||||||
| 	status=$? |  | ||||||
| 	if [ "$status" -eq 0 ]; then |  | ||||||
| 		echo "OK" |  | ||||||
| 	else |  | ||||||
| 		echo "FAIL" |  | ||||||
| 	fi |  | ||||||
| 	return "$status" |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| stop() { | stop() { | ||||||
| 	printf 'Stopping %s: ' "$DAEMON" | 	printf 'Stopping %s: ' "$DAEMON" | ||||||
| 	[ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, " | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
| 	start-stop-daemon -K -q -p "$PIDFILE" | 	start-stop-daemon -K -s 9 -q -p "$PIDFILE" | ||||||
| 	status=$? | 	status=$? | ||||||
| 	if [ "$status" -eq 0 ]; then | 	if [ "$status" -eq 0 ]; then | ||||||
| 		rm -f "$PIDFILE" | 		rm -f "$PIDFILE" | ||||||
|  | @ -56,12 +60,13 @@ restart() { | ||||||
| 	start | 	start | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | reload() { | ||||||
|  | 	load_majestic | ||||||
|  | } | ||||||
|  | 
 | ||||||
| case "$1" in | case "$1" in | ||||||
| 	start|stop|restart) | 	start|stop|restart|reload) | ||||||
| 		"$1";; | 		"$1";; | ||||||
| 	reload) |  | ||||||
| 		# Restart, since there is no true "reload" feature. |  | ||||||
| 		restart;; |  | ||||||
| 	*) | 	*) | ||||||
| 		echo "Usage: $0 {start|stop|restart|reload}" | 		echo "Usage: $0 {start|stop|restart|reload}" | ||||||
| 		exit 1 | 		exit 1 | ||||||
|  |  | ||||||
|  | @ -8,6 +8,21 @@ DAEMON_ARGS="-s" | ||||||
| # shellcheck source=/dev/null | # shellcheck source=/dev/null | ||||||
| [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | ||||||
| 
 | 
 | ||||||
|  | load_majestic() { | ||||||
|  | 	printf 'Starting %s: ' "$DAEMON" | ||||||
|  | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
|  | 	# shellcheck disable=SC2086 # we need the word splitting | ||||||
|  | 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ | ||||||
|  | 		-- $DAEMON_ARGS | ||||||
|  | 	status=$? | ||||||
|  | 	if [ "$status" -eq 0 ]; then | ||||||
|  | 		echo "OK" | ||||||
|  | 	else | ||||||
|  | 		echo "FAIL" | ||||||
|  | 	fi | ||||||
|  | 	return "$status" | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | ||||||
| start() { | start() { | ||||||
| 	logger -s -p daemon.info -t hisilicon "Check MAC for Xiongmai devices" | 	logger -s -p daemon.info -t hisilicon "Check MAC for Xiongmai devices" | ||||||
|  | @ -22,24 +37,13 @@ start() { | ||||||
| 	export TZ=$(cat /etc/TZ) | 	export TZ=$(cat /etc/TZ) | ||||||
| 	load_hisilicon -i | 	load_hisilicon -i | ||||||
| 	# | 	# | ||||||
| 	printf 'Starting %s: ' "$DAEMON" |   load_majestic | ||||||
| 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " |  | ||||||
| 	# shellcheck disable=SC2086 # we need the word splitting |  | ||||||
| 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ |  | ||||||
| 		-- $DAEMON_ARGS |  | ||||||
| 	status=$? |  | ||||||
| 	if [ "$status" -eq 0 ]; then |  | ||||||
| 		echo "OK" |  | ||||||
| 	else |  | ||||||
| 		echo "FAIL" |  | ||||||
| 	fi |  | ||||||
| 	return "$status" |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| stop() { | stop() { | ||||||
| 	printf 'Stopping %s: ' "$DAEMON" | 	printf 'Stopping %s: ' "$DAEMON" | ||||||
| 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
| 	start-stop-daemon -K -q -p "$PIDFILE" | 	start-stop-daemon -K -s 9 -q -p "$PIDFILE" | ||||||
| 	status=$? | 	status=$? | ||||||
| 	if [ "$status" -eq 0 ]; then | 	if [ "$status" -eq 0 ]; then | ||||||
| 		rm -f "$PIDFILE" | 		rm -f "$PIDFILE" | ||||||
|  | @ -56,12 +60,13 @@ restart() { | ||||||
| 	start | 	start | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | reload() { | ||||||
|  | 	load_majestic | ||||||
|  | } | ||||||
|  | 
 | ||||||
| case "$1" in | case "$1" in | ||||||
| 	start|stop|restart) | 	start|stop|restart|reload) | ||||||
| 		"$1";; | 		"$1";; | ||||||
| 	reload) |  | ||||||
| 		# Restart, since there is no true "reload" feature. |  | ||||||
| 		restart;; |  | ||||||
| 	*) | 	*) | ||||||
| 		echo "Usage: $0 {start|stop|restart|reload}" | 		echo "Usage: $0 {start|stop|restart|reload}" | ||||||
| 		exit 1 | 		exit 1 | ||||||
|  |  | ||||||
|  | @ -8,6 +8,21 @@ DAEMON_ARGS="-s" | ||||||
| # shellcheck source=/dev/null | # shellcheck source=/dev/null | ||||||
| [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | ||||||
| 
 | 
 | ||||||
|  | load_majestic() { | ||||||
|  | 	printf 'Starting %s: ' "$DAEMON" | ||||||
|  | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
|  | 	# shellcheck disable=SC2086 # we need the word splitting | ||||||
|  | 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ | ||||||
|  | 		-- $DAEMON_ARGS | ||||||
|  | 	status=$? | ||||||
|  | 	if [ "$status" -eq 0 ]; then | ||||||
|  | 		echo "OK" | ||||||
|  | 	else | ||||||
|  | 		echo "FAIL" | ||||||
|  | 	fi | ||||||
|  | 	return "$status" | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | ||||||
| start() { | start() { | ||||||
| 	logger -s -p daemon.info -t hisilicon "Check MAC for Xiongmai devices" | 	logger -s -p daemon.info -t hisilicon "Check MAC for Xiongmai devices" | ||||||
|  | @ -22,24 +37,13 @@ start() { | ||||||
| 	export TZ=$(cat /etc/TZ) | 	export TZ=$(cat /etc/TZ) | ||||||
| 	load_hisilicon -i | 	load_hisilicon -i | ||||||
| 	# | 	# | ||||||
| 	printf 'Starting %s: ' "$DAEMON" |   load_majestic | ||||||
| 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " |  | ||||||
| 	# shellcheck disable=SC2086 # we need the word splitting |  | ||||||
| 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ |  | ||||||
| 		-- $DAEMON_ARGS |  | ||||||
| 	status=$? |  | ||||||
| 	if [ "$status" -eq 0 ]; then |  | ||||||
| 		echo "OK" |  | ||||||
| 	else |  | ||||||
| 		echo "FAIL" |  | ||||||
| 	fi |  | ||||||
| 	return "$status" |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| stop() { | stop() { | ||||||
| 	printf 'Stopping %s: ' "$DAEMON" | 	printf 'Stopping %s: ' "$DAEMON" | ||||||
| 	[ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, " | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
| 	start-stop-daemon -K -q -p "$PIDFILE" | 	start-stop-daemon -K -s 9 -q -p "$PIDFILE" | ||||||
| 	status=$? | 	status=$? | ||||||
| 	if [ "$status" -eq 0 ]; then | 	if [ "$status" -eq 0 ]; then | ||||||
| 		rm -f "$PIDFILE" | 		rm -f "$PIDFILE" | ||||||
|  | @ -56,12 +60,13 @@ restart() { | ||||||
| 	start | 	start | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | reload() { | ||||||
|  | 	load_majestic | ||||||
|  | } | ||||||
|  | 
 | ||||||
| case "$1" in | case "$1" in | ||||||
| 	start|stop|restart) | 	start|stop|restart|reload) | ||||||
| 		"$1";; | 		"$1";; | ||||||
| 	reload) |  | ||||||
| 		# Restart, since there is no true "reload" feature. |  | ||||||
| 		restart;; |  | ||||||
| 	*) | 	*) | ||||||
| 		echo "Usage: $0 {start|stop|restart|reload}" | 		echo "Usage: $0 {start|stop|restart|reload}" | ||||||
| 		exit 1 | 		exit 1 | ||||||
|  |  | ||||||
|  | @ -8,6 +8,21 @@ DAEMON_ARGS="-s" | ||||||
| # shellcheck source=/dev/null | # shellcheck source=/dev/null | ||||||
| [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | ||||||
| 
 | 
 | ||||||
|  | load_majestic() { | ||||||
|  | 	printf 'Starting %s: ' "$DAEMON" | ||||||
|  | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
|  | 	# shellcheck disable=SC2086 # we need the word splitting | ||||||
|  | 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ | ||||||
|  | 		-- $DAEMON_ARGS | ||||||
|  | 	status=$? | ||||||
|  | 	if [ "$status" -eq 0 ]; then | ||||||
|  | 		echo "OK" | ||||||
|  | 	else | ||||||
|  | 		echo "FAIL" | ||||||
|  | 	fi | ||||||
|  | 	return "$status" | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | ||||||
| start() { | start() { | ||||||
| 	#logger -s -p daemon.info -t novatek "Check MAC for Novatek devices" | 	#logger -s -p daemon.info -t novatek "Check MAC for Novatek devices" | ||||||
|  | @ -21,18 +36,7 @@ start() { | ||||||
| 	export TZ=$(cat /etc/TZ) | 	export TZ=$(cat /etc/TZ) | ||||||
| 	load_novatek -i | 	load_novatek -i | ||||||
| 	# | 	# | ||||||
| 	printf 'Starting %s: ' "$DAEMON" | 	load_majestic | ||||||
| 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " |  | ||||||
| 	# shellcheck disable=SC2086 # we need the word splitting |  | ||||||
| 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ |  | ||||||
| 		-- $DAEMON_ARGS |  | ||||||
| 	status=$? |  | ||||||
| 	if [ "$status" -eq 0 ]; then |  | ||||||
| 		echo "OK" |  | ||||||
| 	else |  | ||||||
| 		echo "FAIL" |  | ||||||
| 	fi |  | ||||||
| 	return "$status" |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| stop() { | stop() { | ||||||
|  | @ -55,12 +59,13 @@ restart() { | ||||||
| 	start | 	start | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | reload() { | ||||||
|  | 	load_majestic | ||||||
|  | } | ||||||
|  | 
 | ||||||
| case "$1" in | case "$1" in | ||||||
| 	start|stop|restart) | 	start|stop|restart|reload) | ||||||
| 		"$1";; | 		"$1";; | ||||||
| 	reload) |  | ||||||
| 		# Restart, since there is no true "reload" feature. |  | ||||||
| 		restart;; |  | ||||||
| 	*) | 	*) | ||||||
| 		echo "Usage: $0 {start|stop|restart|reload}" | 		echo "Usage: $0 {start|stop|restart|reload}" | ||||||
| 		exit 1 | 		exit 1 | ||||||
|  |  | ||||||
|  | @ -8,6 +8,21 @@ DAEMON_ARGS="-s" | ||||||
| # shellcheck source=/dev/null | # shellcheck source=/dev/null | ||||||
| [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | ||||||
| 
 | 
 | ||||||
|  | load_majestic() { | ||||||
|  | 	printf 'Starting %s: ' "$DAEMON" | ||||||
|  | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
|  | 	# shellcheck disable=SC2086 # we need the word splitting | ||||||
|  | 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ | ||||||
|  | 		-- $DAEMON_ARGS | ||||||
|  | 	status=$? | ||||||
|  | 	if [ "$status" -eq 0 ]; then | ||||||
|  | 		echo "OK" | ||||||
|  | 	else | ||||||
|  | 		echo "FAIL" | ||||||
|  | 	fi | ||||||
|  | 	return "$status" | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | ||||||
| start() { | start() { | ||||||
| 	logger -s -p daemon.info -t sigmastar "Check MAC for Sigmastar devices" | 	logger -s -p daemon.info -t sigmastar "Check MAC for Sigmastar devices" | ||||||
|  | @ -21,18 +36,7 @@ start() { | ||||||
| 	export TZ=$(cat /etc/TZ) | 	export TZ=$(cat /etc/TZ) | ||||||
| 	load_sigmastar -i | 	load_sigmastar -i | ||||||
| 	# | 	# | ||||||
| 	printf 'Starting %s: ' "$DAEMON" | 	load_majestic | ||||||
| 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " |  | ||||||
| 	# shellcheck disable=SC2086 # we need the word splitting |  | ||||||
| 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ |  | ||||||
| 		-- $DAEMON_ARGS |  | ||||||
| 	status=$? |  | ||||||
| 	if [ "$status" -eq 0 ]; then |  | ||||||
| 		echo "OK" |  | ||||||
| 	else |  | ||||||
| 		echo "FAIL" |  | ||||||
| 	fi |  | ||||||
| 	return "$status" |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| stop() { | stop() { | ||||||
|  | @ -55,13 +59,14 @@ restart() { | ||||||
| 	start | 	start | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | reload() { | ||||||
|  | 	load_majestic | ||||||
|  | } | ||||||
|  | 
 | ||||||
| case "$1" in | case "$1" in | ||||||
| 	start|stop|restart) | 	start|stop|restart|reload) | ||||||
| 		"$1";; | 		"$1";; | ||||||
| 	reload) |  | ||||||
| 		# Restart, since there is no true "reload" feature. |  | ||||||
| 		restart;; |  | ||||||
| 	*) | 	*) | ||||||
| 		echo "Usage: $0 {start|stop|restart|reload}" | 		echo "Usage: $0 {start|stop|restart|reload}" | ||||||
| 		exit 1 | 		exit 1 | ||||||
| esac | esac | ||||||
|  | @ -8,6 +8,21 @@ DAEMON_ARGS="-s" | ||||||
| # shellcheck source=/dev/null | # shellcheck source=/dev/null | ||||||
| [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | ||||||
| 
 | 
 | ||||||
|  | load_majestic() { | ||||||
|  | 	printf 'Starting %s: ' "$DAEMON" | ||||||
|  | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
|  | 	# shellcheck disable=SC2086 # we need the word splitting | ||||||
|  | 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ | ||||||
|  | 		-- $DAEMON_ARGS | ||||||
|  | 	status=$? | ||||||
|  | 	if [ "$status" -eq 0 ]; then | ||||||
|  | 		echo "OK" | ||||||
|  | 	else | ||||||
|  | 		echo "FAIL" | ||||||
|  | 	fi | ||||||
|  | 	return "$status" | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | ||||||
| start() { | start() { | ||||||
| 	logger -s -p daemon.info -t xiongmai "Check MAC for Xiongmai devices" | 	logger -s -p daemon.info -t xiongmai "Check MAC for Xiongmai devices" | ||||||
|  | @ -25,23 +40,12 @@ start() { | ||||||
| 	SNS_TYPE=$(ipcinfo --short_sensor) | 	SNS_TYPE=$(ipcinfo --short_sensor) | ||||||
| 	logger -s -p daemon.info -t xiongmai "You sensor is $SNS_TYPE" | 	logger -s -p daemon.info -t xiongmai "You sensor is $SNS_TYPE" | ||||||
| 	# | 	# | ||||||
| 	printf 'Starting %s: ' "$DAEMON" | 	load_majestic | ||||||
| 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " |  | ||||||
| 	# shellcheck disable=SC2086 # we need the word splitting |  | ||||||
| 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ |  | ||||||
| 		-- $DAEMON_ARGS |  | ||||||
| 	status=$? |  | ||||||
| 	if [ "$status" -eq 0 ]; then |  | ||||||
| 		echo "OK" |  | ||||||
| 	else |  | ||||||
| 		echo "FAIL" |  | ||||||
| 	fi |  | ||||||
| 	return "$status" |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| stop() { | stop() { | ||||||
| 	printf 'Stopping %s: ' "$DAEMON" | 	printf 'Stopping %s: ' "$DAEMON" | ||||||
| 	[ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, " | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
| 	start-stop-daemon -K -q -p "$PIDFILE" | 	start-stop-daemon -K -q -p "$PIDFILE" | ||||||
| 	status=$? | 	status=$? | ||||||
| 	if [ "$status" -eq 0 ]; then | 	if [ "$status" -eq 0 ]; then | ||||||
|  | @ -59,12 +63,13 @@ restart() { | ||||||
| 	start | 	start | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | reload() { | ||||||
|  | 	load_majestic | ||||||
|  | } | ||||||
|  | 
 | ||||||
| case "$1" in | case "$1" in | ||||||
| 	start|stop|restart) | 	start|stop|restart|reload) | ||||||
| 		"$1";; | 		"$1";; | ||||||
| 	reload) |  | ||||||
| 		# Restart, since there is no true "reload" feature. |  | ||||||
| 		restart;; |  | ||||||
| 	*) | 	*) | ||||||
| 		echo "Usage: $0 {start|stop|restart|reload}" | 		echo "Usage: $0 {start|stop|restart|reload}" | ||||||
| 		exit 1 | 		exit 1 | ||||||
|  |  | ||||||
|  | @ -8,6 +8,21 @@ DAEMON_ARGS="-s" | ||||||
| # shellcheck source=/dev/null | # shellcheck source=/dev/null | ||||||
| [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" | ||||||
| 
 | 
 | ||||||
|  | load_majestic() { | ||||||
|  | 	printf 'Starting %s: ' "$DAEMON" | ||||||
|  | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
|  | 	# shellcheck disable=SC2086 # we need the word splitting | ||||||
|  | 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ | ||||||
|  | 		-- $DAEMON_ARGS | ||||||
|  | 	status=$? | ||||||
|  | 	if [ "$status" -eq 0 ]; then | ||||||
|  | 		echo "OK" | ||||||
|  | 	else | ||||||
|  | 		echo "FAIL" | ||||||
|  | 	fi | ||||||
|  | 	return "$status" | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | # The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one. | ||||||
| start() { | start() { | ||||||
| 	logger -s -p daemon.info -t xiongmai "Check MAC for Xiongmai devices" | 	logger -s -p daemon.info -t xiongmai "Check MAC for Xiongmai devices" | ||||||
|  | @ -39,23 +54,12 @@ start() { | ||||||
| 		esac | 		esac | ||||||
| 	fi | 	fi | ||||||
| 	# | 	# | ||||||
| 	printf 'Starting %s: ' "$DAEMON" | 	load_majestic | ||||||
| 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " |  | ||||||
| 	# shellcheck disable=SC2086 # we need the word splitting |  | ||||||
| 	start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ |  | ||||||
| 		-- $DAEMON_ARGS |  | ||||||
| 	status=$? |  | ||||||
| 	if [ "$status" -eq 0 ]; then |  | ||||||
| 		echo "OK" |  | ||||||
| 	else |  | ||||||
| 		echo "FAIL" |  | ||||||
| 	fi |  | ||||||
| 	return "$status" |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| stop() { | stop() { | ||||||
| 	printf 'Stopping %s: ' "$DAEMON" | 	printf 'Stopping %s: ' "$DAEMON" | ||||||
| 	[ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, " | 	[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, " | ||||||
| 	start-stop-daemon -K -q -p "$PIDFILE" | 	start-stop-daemon -K -q -p "$PIDFILE" | ||||||
| 	status=$? | 	status=$? | ||||||
| 	if [ "$status" -eq 0 ]; then | 	if [ "$status" -eq 0 ]; then | ||||||
|  | @ -73,13 +77,15 @@ restart() { | ||||||
| 	start | 	start | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | reload() { | ||||||
|  | 	load_majestic | ||||||
|  | } | ||||||
|  | 
 | ||||||
| case "$1" in | case "$1" in | ||||||
| 	start|stop|restart) | 	start|stop|restart|reload) | ||||||
| 		"$1";; | 		"$1";; | ||||||
| 	reload) |  | ||||||
| 		# Restart, since there is no true "reload" feature. |  | ||||||
| 		restart;; |  | ||||||
| 	*) | 	*) | ||||||
| 		echo "Usage: $0 {start|stop|restart|reload}" | 		echo "Usage: $0 {start|stop|restart|reload}" | ||||||
| 		exit 1 | 		exit 1 | ||||||
| esac | esac | ||||||
|  | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue