Răsfoiți Sursa

pkg: updated init script for kamailio debian package

- extra checks after starting kamailio
- patch by Klaus Darilion, FS#113
Daniel-Constantin Mierla 14 ani în urmă
părinte
comite
3a2ce8df89
1 a modificat fișierele cu 10 adăugiri și 2 ștergeri
  1. 10 2
      pkg/kamailio/deb/debian/kamailio.init

+ 10 - 2
pkg/kamailio/deb/debian/kamailio.init

@@ -124,8 +124,16 @@ case "$1" in
 
 	echo -n "Starting $DESC: $NAME"
 	start-stop-daemon --start --quiet --pidfile $PIDFILE \
-		--exec $DAEMON -- $OPTIONS || echo -n " already running"
-	echo "."
+		--exec $DAEMON -- $OPTIONS || if [ ! -r "$PIDFILE" ]; then
+			echo " error, failed to start."
+			exit 1
+		elif read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then
+			echo -n " already running"
+			echo "."
+		else
+			echo " error, failed to start ($PIDFILE exists)."
+			exit 1
+		fi
 	;;
   stop)
 	echo -n "Stopping $DESC: $NAME"