Browse Source

修改启动启动和停止时的日志

tangs 5 years ago
parent
commit
1df539b94a
1 changed files with 4 additions and 3 deletions
  1. 4 3
      server.sh

+ 4 - 3
server.sh

@@ -24,8 +24,8 @@ start (){
 		exit
 	fi
 
-	start-stop-daemon --start --make-pidfile --background --pidfile=$PROCESS --chuid=$USER --exec=$DAEMON
-	echo "$NAME start successful, pid(`cat $PROCESS`)"
+	start-stop-daemon --start --make-pidfile --background --pidfile=$PROCESS --user=$USER --exec=$DAEMON
+	test $? -ne 0 || echo "$NAME start successful, pid(`cat $PROCESS`)"
 }
 
 # Stop the server
@@ -34,10 +34,11 @@ stop (){
 	start-stop-daemon --status --pidfile=$PROCESS
 	if [ $? != 0 ]; then
 		echo "$NAME is not running"
+		exit
 	fi
 
 	start-stop-daemon --stop --pidfile=$PROCESS
-	echo "$NAME stop successful"
+	test $? -ne 0 || echo "$NAME stop successful"
 }
 
 # Return the status of the server