SME Service Restart/Stop/Start echo "command not found"

From wiki.linuxonlinehelp.de
Jump to: navigation, search

SME Service Restart/Stop/Start echo "command not found" on line 3

if you on console want to restart a service manual with:

$ service squid stop

the echo show Message: /sbin/e-smith/service: line 3: runlevel: command not found

to solve edit as root with:

$nano /sbin/e-smith/service

from:

#! /bin/sh

runlevel=$(runlevel | cut -d" " -f2)

if [ "$runlevel" = "7" ]
then
    if ls /etc/rc7.d/S??$1 >/dev/null 2>/dev/null
    then
       script=$(ls /etc/rc7.d/S??$1 | head -1)
       exec $script $2
    fi

    echo "'$1' is not a valid service name" 1>&2
    exit 1
else
    exec /sbin/service "$@"
fi

to:

#! /bin/sh

runlevel=$(/sbin/runlevel | cut -d" " -f2)

if [ "$runlevel" = "7" ]
then
    if ls /etc/rc7.d/S??$1 >/dev/null 2>/dev/null
    then
       script=$(ls /etc/rc7.d/S??$1 | head -1)
       exec $script $2
    fi

    echo "'$1' is not a valid service name" 1>&2
    exit 1
else
    exec /sbin/service "$@"
fi

Now the Error Message should disappear, cause the path of the "/sbin/runlevel" command is set correct, may be a $PATH or ENV Problem of the root User Profile.