Changes

Jump to navigation Jump to search
no edit summary
== SME Service Restart/Stop/Start echo "command not found" on line 3==

if you on console want to restart a service manual with:
<pre>
$ service squid stop
</pre>
the echo show Message:
/sbin/e-smith/service: line 3: runlevel: command not found

to solve edit as root with:
<pre>
$nano /sbin/e-smith/service
</pre>
from:
<pre>
#! /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
</pre>

to:
<pre>
#! /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
</pre>

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.

Navigation menu