Stoping server

94 views
Skip to first unread message

nirit topol

unread,
Apr 23, 2012, 6:13:23 AM4/23/12
to diaspora...@googlegroups.com
Hi,


I am running the server in background
how do I stop the server safely without killing his process 


thank
Nirit

Sean Tilley

unread,
Apr 23, 2012, 3:51:01 PM4/23/12
to diaspora...@googlegroups.com
Hi there,

To stop the server in such a way that you can easily start it up again, you use Ctrl + C. Many people make the mistake of using Ctrl + X, which doesn't actually kill the process. (It kills the server, but the process basically runs in zombie mode).

nirit topol

unread,
Apr 23, 2012, 4:59:43 PM4/23/12
to diaspora...@googlegroups.com
thanks,

I know about Ctrl+C but when I run the ./script/server& in background mode this solution is not working.


בתאריך יום שני, 23 באפריל 2012 22:51:01 UTC+3, מאת Sean Tilley:

Raven24

unread,
Apr 23, 2012, 8:00:55 PM4/23/12
to diaspora...@googlegroups.com
If you sent it to the background with "&", you can get it back by executing `fg`
Then it can be stopped with [ctrl]+[c] again.

On this note: please, if you run a server get yourself a little familiar with tools like `screen` [1]
and basic process management from the console. ;)

[1]: http://www.debian-administration.org/articles/34

Sofocle

unread,
May 14, 2014, 9:09:39 AM5/14/14
to diaspora...@googlegroups.com
What if the server automatically starts on startup with the init.d script provided in the wiki ?
How can I stop it ?

This is the beginning of the script : 

#  Diaspora
#
# chkconfig: 345 91 10
# description: Starts and stops the Diaspora daemon.
#

PROC_NAME=Diaspora
DIASPORA_HOME=/var/www/diaspora
# Change the user to whichever user you need
RUN_AS_USER=diaspora
startup="cd $DIASPORA_HOME; ./script/server"
# Replace by stop/shutdown command
shutdown="$DIASPORA_HOME/script/server"

start(){
 echo -n $"Starting $PROC_NAME service: "
 su -l $RUN_AS_USER -c "$startup"
 RETVAL=$?
 echo
}

stop(){
 echo -n $"Stoping $PROC_NAME service: "
 # Uncomment here to allow stop
 su -l $RUN_AS_USER -c "$shutdown"
 RETVAL=$?
 echo
}

restart(){
  stop
  start
}

(...)


-------------------------------------------------

Obviously this is not the right command : shutdown="$DIASPORA_HOME/script/server"

Could someone give me a hint ? ;)
I'm trying to get the less barbaric command to shutdown server on demand for using the service diaspora stop/restart command.

Best regards !
Reply all
Reply to author
Forward
0 new messages