more graceful handling of missing pidfile, #1395

This commit is contained in:
Julian Lam
2014-04-17 12:09:42 -04:00
parent 20d1723e84
commit d95398f808

20
nodebb
View File

@@ -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)