Skip to content

Node.js based forum software built for the modern web

more graceful handling of missing pidfile, #1395

Julian Lamd95398f8081a
diff --git a/nodebb b/nodebb
index bf7b82e42e..e88744c081 100755
--- a/nodebb
+++ b/nodebb
@@ -33,13 +33,25 @@ case "$1" in
;;
stop)
- echo "Stopping NodeBB. Goodbye!";
- kill $(cat pidfile);
+ pidExists;
+ if [ 0 -eq $? ];
+ then
+ echo "NodeBB is already stopped.";
+ else
+ echo "Stopping NodeBB. Goodbye!";
+ kill $(cat pidfile);
+ fi
;;
reload|restart)
- echo "Restarting NodeBB.";
- kill -1 $(cat pidfile);
+ pidExists;
+ if [ 0 -eq $? ];
+ then
+ echo "NodeBB could not be restarted, as a running instance could not be found.";
+ else
+ echo "Restarting NodeBB.";
+ kill -1 $(cat pidfile);
+ fi
;;
status)