In Systemd, runlevel returns "unknown" and generate errors. Use strings (but do not detect if the system is booting)

This commit is contained in:
2025-10-02 11:32:24 +02:00
parent 2bbff4b3ea
commit 7e92d5480f

4
check
View File

@@ -18,12 +18,12 @@ fi
RUNLEVEL=`runlevel | cut -f 2 -d ' '` RUNLEVEL=`runlevel | cut -f 2 -d ' '`
[ "x$RUNLEVEL" == "x" ] && RUNLEVEL=0 [ "x$RUNLEVEL" == "x" ] && RUNLEVEL=0
if [ $RUNLEVEL -eq 0 ] || [ $RUNLEVEL -eq 6 ]; then if [ "$RUNLEVEL" == "0" ] || [ "$RUNLEVEL" == "6" ]; then
echo "Arret ou reboot en cours : on sort" echo "Arret ou reboot en cours : on sort"
exit exit
fi fi
if [ $RUNLEVEL -eq 1 ]; then if [ "$RUNLEVEL" == "1" ]; then
echo "Démarrage en cours : on sort" echo "Démarrage en cours : on sort"
exit exit
fi fi