3. Starting and Stopping AvnFPS

All AvnFPS programs: servers, clients and utilities are started by a shell script avnstart.sh. This script is responsible for setting appropriate environmental variables required by AvnFPS. The variables are actually set in the file bin/avnenv.sh which is sourced by avnstart.sh. The first argument is program name (a Python script residing in the directory py without the extension .py). Remaining arguments, if any, are passed to the program without modification.

3.1. Starting AvnFPS Servers

AvnFPS requires four servers. These are:

  • avnserver: Helps client processes find the services they need (name service) and notifies clients when data are available (event service).

  • avndis: Data Ingest Server. Copies data from various AWIPS sources into AvnFPS directory tree, reformatting as needed.

  • avndrs: Data Request Server. Answers requests for data from client processes.

  • avnxs: Forecast Transmission Server. Manages transmit queues and the interface to the AWIPS software that transmits products.

The order in which the servers are started is important. avnserver must be started first. There can be only one instance of avnserver within WFO subnet; running it on both px1 and px2 will lead to unexpected results. avndis depends on avndrs to process Low Level Wind Shear data, so avndrs needs to be started first. The simplest way to avoid these problems is to not launch these servers directly. The application avninit searches for active instances of all four AvnFPS servers and launches the ones that are not running. This application is modelled on the Unix™ SYSV init and the AWIPS DataController. Like init and DataController, avninit is a persistent process.

[Note]Note

avninit will attempt to restart a failed server 10 times within an hour. When the number of restarts exceeds 10, avninit will stop trying to restart the failed server.

avninit is invoked by the AWIPS startup script px2apps together with other AWIPS applications. If you have to start the servers afterwards, use the shell script remoteServers.sh. The script accepts the following command line arguments:

remoteServers.sh [ start | stop | restart ]

This script has to be run as user fxa. It uses ssh to start/stop avninit on px2. Therefore it can be run from any workstation. It is located in the directory /awips/adapt/avnfps/bin. Example usage:

lx2-wfo: /awips/adapt/avnfps/bin/remoteServers.sh start
		

To list avnfps processes use the ps command. A typical output on px2 is:

px2-wfo: ps -ejHf | grep avnpython
fxa    6069     1  09:30  00:00:00 avnpython /awips/adapt/avnfps/3.5/py/avninit.py px2f
fxa    6073  6069  09:30  00:00:12   avnpython /awips/adapt/avnfps/3.5/py/avnserver.py -d -n px2f
fxa    6075  6069  09:30  00:00:01   avnpython /awips/adapt/avnfps/3.5/py/avndrs.py -d -n px2f
fxa    6078  6069  09:30  00:07:48   avnpython /awips/adapt/avnfps/3.5/py/avndis.py -d -n px2f
fxa    6079  6069  09:30  00:00:01   avnpython /awips/adapt/avnfps/3.5/py/avnxs.py -d -n px2f
		

If you wish to see all the threads in hierarchical format, add -L option to ps:

px2-wfo: ps -eLf | grep avnpython
fxa    6069     1  09:30  00:00:00 avnpython /awips/adapt/avnfps/3.5/py/avninit.py px2f
fxa    6073  6069  09:30  00:00:00 avnpython /awips/adapt/avnfps/3.5/py/avnserver.py -d -n px2f
fxa    6073  6069  09:30  00:00:00 avnpython /awips/adapt/avnfps/3.5/py/avnserver.py -d -n px2f
fxa    6073  6069  09:30  00:00:00 avnpython /awips/adapt/avnfps/3.5/py/avnserver.py -d -n px2f
fxa    6073  6069  09:30  00:00:00 avnpython /awips/adapt/avnfps/3.5/py/avnserver.py -d -n px2f
fxa    6073  6069  09:30  00:00:00 avnpython /awips/adapt/avnfps/3.5/py/avnserver.py -d -n px2f
fxa    6073  6069  09:30  00:00:00 avnpython /awips/adapt/avnfps/3.5/py/avnserver.py -d -n px2f
fxa    6073  6069  09:30  00:00:04 avnpython /awips/adapt/avnfps/3.5/py/avnserver.py -d -n px2f
fxa    6073  6069  09:30  00:00:00 avnpython /awips/adapt/avnfps/3.5/py/avnserver.py -d -n px2f
fxa    6073  6069  09:30  00:00:01 avnpython /awips/adapt/avnfps/3.5/py/avnserver.py -d -n px2f
fxa    6073  6069  09:30  00:00:05 avnpython /awips/adapt/avnfps/3.5/py/avnserver.py -d -n px2f
fxa    6075  6069  09:30  00:00:00 avnpython /awips/adapt/avnfps/3.5/py/avndrs.py -d -n px2f
fxa    6075  6069  09:30  00:00:00 avnpython /awips/adapt/avnfps/3.5/py/avndrs.py -d -n px2f
fxa    6075  6069  09:30  00:00:00 avnpython /awips/adapt/avnfps/3.5/py/avndrs.py -d -n px2f
fxa    6075  6069  09:30  00:00:00 avnpython /awips/adapt/avnfps/3.5/py/avndrs.py -d -n px2f
fxa    6078  6069  09:30  00:00:04 avnpython /awips/adapt/avnfps/3.5/py/avndis.py -d -n px2f
fxa    6078  6069  09:30  00:00:09 avnpython /awips/adapt/avnfps/3.5/py/avndis.py -d -n px2f
fxa    6078  6069  09:30  00:00:53 avnpython /awips/adapt/avnfps/3.5/py/avndis.py -d -n px2f
fxa    6078  6069  09:30  00:04:42 avnpython /awips/adapt/avnfps/3.5/py/avndis.py -d -n px2f
fxa    6078  6069  09:30  00:00:06 avnpython /awips/adapt/avnfps/3.5/py/avndis.py -d -n px2f
fxa    6078  6069  09:30  00:00:00 avnpython /awips/adapt/avnfps/3.5/py/avndis.py -d -n px2f
fxa    6078  6069  09:30  00:00:00 avnpython /awips/adapt/avnfps/3.5/py/avndis.py -d -n px2f
fxa    6078  6069  09:30  00:00:02 avnpython /awips/adapt/avnfps/3.5/py/avndis.py -d -n px2f
fxa    6078  6069  09:30  00:00:06 avnpython /awips/adapt/avnfps/3.5/py/avndis.py -d -n px2f
fxa    6078  6069  09:30  00:02:15 avnpython /awips/adapt/avnfps/3.5/py/avndis.py -d -n px2f
fxa    6079  6069  09:30  00:00:01 avnpython /awips/adapt/avnfps/3.5/py/avnxs.py -d -n px2f
		

[Note]Note

Red Hat Enterprise 4™ threads are listed differently by ps. The -H (process hierarchy) option cannot be used with the thread (m, L or T) request.

3.2. Stopping AvnFPS Servers

Normally you should use the script remoteServers.sh:

lx2-wfo:96: /awips/adapt/avnfps/bin/remoteServers.sh stop
		

Another option is to log on to the host(s) where AvnFPS servers run and use the avnkill command. This command is also located in /awips/adapt/avnfps/bin directory. The avnkill first issues a SIGTERM signal, then it waits 30 seconds for all threads to terminate gracefully. If the threads do not exit, avnkill issues a SIGKILL signal to those processes that continue to run. Yet another option is to send a SIGTERM signal to avninit. For example listed in the previous section, to stop avninit, the command would be:

px2-wfo:4: kill 6069
		

This should stop all the servers since avninit sends SIGTERM to all its child processes before quitting.

[Note]Note

When avninit stops, for whatever reason, the existing servers are stopped as well.

Under special circumstances, (e.g., a hung server), you may want to stop and start a single server. Since avninit monitors the servers and starts those which are not running, the only action needed is killing the hung process. Bear in mind that the servers are threaded and only the top-level thread accepts signals.

For the ps listing in the previous section, the hierarchy is represented by order. For instance, to restart the avndrs server, find the first occurrence of avndrs in the output above, and type:

px2-wfo:4: kill 6075
		

This will kill process 6075 and its threads. Once the avndrs server exits, avninit will start a new avndrs server instance.