From 834bc656aa83ae548a9c578c69699f97252be07f Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sat, 3 Aug 2019 14:55:22 +0200 Subject: [PATCH] - start_neutrino: better readability --- skel-root/armbox/bre2ze4k/etc/init.d/start_neutrino | 12 +++++++++--- skel-root/armbox/hd51/etc/init.d/start_neutrino | 12 +++++++++--- skel-root/coolstream/hd1/etc/init.d/start_neutrino | 12 +++++++++--- skel-root/coolstream/hd2/etc/init.d/start_neutrino | 12 +++++++++--- 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/skel-root/armbox/bre2ze4k/etc/init.d/start_neutrino b/skel-root/armbox/bre2ze4k/etc/init.d/start_neutrino index 59ddb6da..56812355 100755 --- a/skel-root/armbox/bre2ze4k/etc/init.d/start_neutrino +++ b/skel-root/armbox/bre2ze4k/etc/init.d/start_neutrino @@ -2,6 +2,12 @@ . /etc/init.d/globals +# Neutrino's exit codes +ERROR=-1 +NORMAL=0 +SHUTDOWN=1 +REBOOT=2 + if [ -e /var/etc/.coredump ]; then ulimit -c unlimited fi @@ -33,13 +39,13 @@ while true; do neutrino; RET=$? LOGINFO "Neutrino exited with exit code $RET" - if [ $RET -eq 0 ]; then + if [ $RET -eq $NORMAL ]; then # do nothing break - elif [ $RET -eq 1 ]; then + elif [ $RET -eq $SHUTDOWN ]; then do_shutdown break - elif [ $RET -eq 2 ]; then + elif [ $RET -eq $REBOOT ]; then do_cleanup do_reboot break diff --git a/skel-root/armbox/hd51/etc/init.d/start_neutrino b/skel-root/armbox/hd51/etc/init.d/start_neutrino index 59ddb6da..56812355 100755 --- a/skel-root/armbox/hd51/etc/init.d/start_neutrino +++ b/skel-root/armbox/hd51/etc/init.d/start_neutrino @@ -2,6 +2,12 @@ . /etc/init.d/globals +# Neutrino's exit codes +ERROR=-1 +NORMAL=0 +SHUTDOWN=1 +REBOOT=2 + if [ -e /var/etc/.coredump ]; then ulimit -c unlimited fi @@ -33,13 +39,13 @@ while true; do neutrino; RET=$? LOGINFO "Neutrino exited with exit code $RET" - if [ $RET -eq 0 ]; then + if [ $RET -eq $NORMAL ]; then # do nothing break - elif [ $RET -eq 1 ]; then + elif [ $RET -eq $SHUTDOWN ]; then do_shutdown break - elif [ $RET -eq 2 ]; then + elif [ $RET -eq $REBOOT ]; then do_cleanup do_reboot break diff --git a/skel-root/coolstream/hd1/etc/init.d/start_neutrino b/skel-root/coolstream/hd1/etc/init.d/start_neutrino index 4a08fb13..37f7fdf9 100755 --- a/skel-root/coolstream/hd1/etc/init.d/start_neutrino +++ b/skel-root/coolstream/hd1/etc/init.d/start_neutrino @@ -2,6 +2,12 @@ . /etc/init.d/globals +# Neutrino's exit codes +ERROR=-1 +NORMAL=0 +SHUTDOWN=1 +REBOOT=2 + # if neutrino crashes, just restart it or reboot the box? REBOOT_ON_ERROR=true @@ -26,13 +32,13 @@ while true; do neutrino; RET=$? LOGINFO "Neutrino exited with exit code $RET" - if [ $RET -eq 0 ]; then + if [ $RET -eq $NORMAL ]; then # do nothing break - elif [ $RET -eq 1 ]; then + elif [ $RET -eq $SHUTDOWN ]; then do_shutdown break - elif [ $RET -eq 2 ]; then + elif [ $RET -eq $REBOOT ]; then do_cleanup do_reboot break diff --git a/skel-root/coolstream/hd2/etc/init.d/start_neutrino b/skel-root/coolstream/hd2/etc/init.d/start_neutrino index ceba4bc4..b229f2ee 100755 --- a/skel-root/coolstream/hd2/etc/init.d/start_neutrino +++ b/skel-root/coolstream/hd2/etc/init.d/start_neutrino @@ -6,6 +6,12 @@ if [ -e /var/etc/.coredump ]; then ulimit -c unlimited fi +# Neutrino's exit codes +ERROR=-1 +NORMAL=0 +SHUTDOWN=1 +REBOOT=2 + # if neutrino crashes, just restart it or reboot the box? REBOOT_ON_ERROR=true @@ -30,13 +36,13 @@ while true; do neutrino; RET=$? LOGINFO "Neutrino exited with exit code $RET" - if [ $RET -eq 0 ]; then + if [ $RET -eq $NORMAL ]; then # do nothing break - elif [ $RET -eq 1 ]; then + elif [ $RET -eq $SHUTDOWN ]; then do_shutdown break - elif [ $RET -eq 2 ]; then + elif [ $RET -eq $REBOOT ]; then do_cleanup do_reboot break