Starting, Restarting and Stopping your mongoose server
Starting the server
-
Change to the server root directory
cd ~/3993.server
-
Start the server, using the current directory as the location of the
configuration files
/depot/http/bin/httpd -d .
Restarting the server
-
Change to the server root directory
cd ~/3993.server
-
Send a hang-up signal to the server. The ` characters below are not the single
quote ' character, they are the accent grave character, which is usually
on the same key as the tilda ~.
kill -HUP `cat logs/httpd.pid`
Stopping the server
-
Change to the server root directory
cd ~/3993.server
-
Send a terminate signal to the server. This will also terminate all the spare
servers.
kill -TERM `cat logs/httpd.pid`
Obtaining the process ID (pid) of your server
-
Issue the command ps -gx to see a list of your server and spare servers
-
Issue the command ps -x to see a list of your spare servers only.
-
The main server is the one that was in the first list, but not in the second.
-
Read the pid number for the server. You can use this number directly to hup
and kill your server. For example, if the pid was 12345, these commands would
work
kill -TERM 12345
kill -HUP 12345
Obtaining a script files for shortcuts to the above commands
The above commands are tedious to type all the time. It is possible to create
small executable script files that will simplify managing the server
I have written a script that can do all of the above, and more. It has five
options: start, stop, hup, pid, info.
-
start
-
start the server
-
stop
-
stop the server
-
hup
-
make the server reread its configuration files
-
pid
-
display the process ID of the main server
-
info
-
display the pid and start time of all the servers in your pool.
To get a copy of this
-
Change to your server directory
cd ~/3993.server
-
Copy the script to your directory
cp ~downeyt/public/scripts/server .
-
Make sure it is executable
chmod 700 server
To execute this command, just change to your server directory and type ./
followed by the script name and the option. For example
-
./server start
-
./server stop
-
./server hup
-
./server pid
-
./server info