]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
Set default PATH and use it along with TERM when starting services.
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Fri, 31 Oct 2003 00:02:02 +0000 (00:02 +0000)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Fri, 31 Oct 2003 00:02:02 +0000 (00:02 +0000)
svn-id: @1464

service

diff --git a/service b/service
index 73fbf7679443485ee1d5a4424f04edd01a634b4e..3adfc810b71c289ccae226a8a67f3b50ed2ab798 100755 (executable)
--- a/service
+++ b/service
@@ -1,9 +1,15 @@
 #!/bin/sh
 
+# Set up a default search path.
+PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
+export PATH
+
 VERSION="`basename $0` ver. 0.91"
 USAGE="Usage: `basename $0` < option > | --status-all | \
 [ service_name [ command | --full-restart ] ]"
+
 SERVICE=
+
 if [ -d /etc/rc.d/init.d ]; then
     SERVICEDIR="/etc/rc.d/init.d"
 else
@@ -28,7 +34,7 @@ while [ $# -gt 0 ]; do
        ;;
     *)
        if [ -z "${SERVICE}" -a $# -eq 1 -a "${1}" = "--status-all" ]; then
-          cd /
+          cd ${SERVICEDIR}
           for SERVICE in * ; do
             case "${SERVICE}" in
               functions | halt | killall | single| linuxconf| kudzu | \
@@ -36,7 +42,7 @@ while [ $# -gt 0 ]; do
                   ;;
               *)
                 if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
-                  env -i LANG=$LANG "${SERVICEDIR}/${SERVICE}" status
+                  env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" status
                 fi
                 ;;
             esac
@@ -44,10 +50,9 @@ while [ $# -gt 0 ]; do
           exit 0
        elif [ $# -eq 2 -a "${2}" = "--full-restart" ]; then
           SERVICE="${1}"
-          cd /
           if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
-            env -i LANG=$LANG "${SERVICEDIR}/${SERVICE}" stop
-            env -i LANG=$LANG "${SERVICEDIR}/${SERVICE}" start
+            env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" stop
+            env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" start
             exit $?
           fi
        elif [ -z "${SERVICE}" ]; then
@@ -61,7 +66,7 @@ while [ $# -gt 0 ]; do
 done
 
 if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
-   env -i LANG=$LANG "${SERVICEDIR}/${SERVICE}" ${OPTIONS}
+   env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" ${OPTIONS}
 else
    echo "${SERVICE}: unrecognized service" >&2
    exit 1
This page took 0.173062 seconds and 4 git commands to generate.