Server Process Management

In some cases, groups or projects may need to automatically start and stop a set of servers that run on various computers throughout the lab. For example, the following outline was made for the CESR Control System.

Outline

Here is a quick example of one possible approach to managing the various servers you have running on control system nodes. For reference, everything for the example is contained in /home/dab66/services/, and is hopefully fairly straight-forward.

For my example, I use a very basic TCP echo server located in /home/dab66/services/bin/echoserver.py

For starting, stopping, and restarting this server, I created an init script located in /home/dab66/services/init.d/echoserver . Using the init script, one can start the service "/home/dab66/services/init.d/echoserver start" and similarly stop the service "/home/dab66/services/init.d/echoserver stop". As you can see, the init script takes care of saving the pid of the running server in (for example) /home/dab66/services/run/lnx100-echoserver.pid.

Depending on your exact needs and the nature of the servers you need to manage, there are several possible approaches to listing what servers should start on what systems. One approach that might be easy to maintain is to simply create a text file for each host that states what services should run on that host. See, for example, /home/dab66/services/hosts/lnx100 and /home/dab66/services/hosts/lnx233.

With all of this in place (and with our password-less control system authentication), it should be easy to write scripts to start all servers on all hosts (/home/dab66/services/bin/start_all_services), start all servers on the current host (/home/dab66/services/bin/start_my_services), etc.

Finally, you could call start_my_services on a regular basis using cron. This would ensure that all servers are started automatically when a system boots.
*/5 * * * * /home/dab66/services/bin/start_my_services >/path/to/log

Of course this is all just an example, and the exact implementation will need to be tailored for your use.

Implementations

The above outline is just an example. For details on a production implementation, please see the help page for CESR Control System users: https://cesrweb.lepp.cornell.edu/machinfo/control/services.html

This topic: Computing > WebHome > LinuxSupport > ServerProcessManagement
Topic revision: 11 May 2010, dab66
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding CLASSE Wiki? Send feedback