[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1859: Start/stop scripts do not work when not invoked by init



Harald Schueler writes:
> I think "functions" should restore the arguments. The following patch
> makes works for me:

I prefer the patch below.

Ian.

--- /etc/init.d/functions	Sat Feb 25 21:20:35 1995
+++ /dev/null	Thu Mar 30 21:18:57 1995
@@ -1,76 +0,0 @@
-#! /bin/sh
-#
-# functions	This file contains functions to be used by most or all
-#		shell scripts in the /etc/init.d directory.
-#
-# Version:	@(#) /etc/init.d/functions 2.00 03-Oct-1994
-#
-# Author:	Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
-#		Riku Meskanen, <mesrik@jyu.fi>
-#
-
-  # First set up a default search path.
-  export PATH="/sbin:/usr/sbin:/bin:/usr/bin"
-
-  # Set RUNLEVEL and PREVLEVEL
-  if [ "$RUNLEVEL" = "" ]
-  then
-	levels=`runlevel`
-	if [ $? = 0 ]
-	then
-		eval set $levels
-		PREVLEVEL=$1
-		RUNLEVEL=$2
-	fi
-  fi
-
-  # A function to start a program.
-  daemon() {
-	Usage="Usage: daemon [-n] {program}"
-	# Test syntax.
-	if [ $# = 0 ]
-	then
-		echo $Usage
-		return 1
-	fi
-	case "$1" in
-	  "-n")	noecho=1
-		shift
-		if [ -z "$1" ]
-		then
-		   echo $Usage
-		   return 1
-		fi
-		;;
-	    *)  noecho=0
-		;;
-	esac
-
-	# See if it already runs (must exclude ourselves!)
-	[ ! -z "`pidof -o $$ -o %PPID $1`" ]  && return
-
-	# echo basename of the program.
-	[ $noecho = 0 ] && echo -n "${1##*/} "
-
-	# And start it up.
-	$*
-  }
-
-  # A function to stop a program.
-  killproc() {
-	# Test syntax.
-	if [ $# = 0 ]
-	then
-		echo "Usage: killprog {program}"
-		return 1
-	fi
-	pid=`pidof -o $$ -o %PPID $1`
-	if [ "$pid" != "" ]
-	then
-	   echo -n "Killing $pid "
-	   kill -9 "$pid"
-	else
-	   echo "$1 already down"
-	fi
-  }
-


Reply to: