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      18202     1 18201 18201  0 Apr28 ?        00:00:00   avnpython /awips/adapt/avnfps/OB8.3/py/avninit.py px2f
fxa      18203 18202 18201 18201  0 Apr28 ?        00:06:46     avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18224 18202 18201 18201  0 Apr28 ?        00:02:10     avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18239 18202 18201 18201  0 Apr28 ?        00:17:02     avnpython /awips/adapt/avnfps/OB8.3/py/avndis.py -d -n px2f
fxa      18250 18202 18201 18201  0 Apr28 ?        00:00:55     avnpython /awips/adapt/avnfps/OB8.3/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      18202     1 18202  0    1 Apr28 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avninit.py px2f
fxa      18203 18202 18203  0   19 Apr28 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202 18204  0   19 Apr28 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202 18222  0   19 Apr28 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202 18223  0   19 Apr28 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202 18229  0   19 Apr28 ?        00:00:26 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202 18257  0   19 Apr28 ?        00:00:53 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202 18258  0   19 Apr28 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202 18260  0   19 Apr28 ?        00:01:04 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202 18262  0   19 Apr28 ?        00:01:10 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202 18267  0   19 Apr28 ?        00:00:31 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202 12155  0   19 May01 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202 12156  0   19 May01 ?        00:00:09 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202 12158  0   19 May01 ?        00:00:37 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202 21876  0   19 06:09 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202 21877  0   19 06:09 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202 21878  0   19 06:09 ?        00:00:02 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202  9029  0   19 11:58 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202  9030  0   19 11:58 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18203 18202  9032  0   19 11:58 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avnserver.py -d -n px2f
fxa      18224 18202 18224  0   23 Apr28 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 18226  0   23 Apr28 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 18227  0   23 Apr28 ?        00:00:04 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 18272  0   23 Apr28 ?        00:00:08 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 12157  0   23 May01 ?        00:00:24 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 12159  0   23 May01 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 12160  0   23 May01 ?        00:00:01 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 12161  0   23 May01 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 12162  0   23 May01 ?        00:00:04 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 12186  0   23 May01 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 16203  0   23 May01 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 21879  0   23 06:09 ?        00:00:01 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 21880  0   23 06:09 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 21881  0   23 06:09 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 21882  0   23 06:09 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 21883  0   23 06:09 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 23108  0   23 11:12 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202 27969  0   23 11:23 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202  9031  0   23 11:58 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202  9033  0   23 11:58 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202  9034  0   23 11:58 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202  9035  0   23 11:58 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18224 18202  9036  0   23 11:58 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndrs.py -d -n px2f
fxa      18239 18202 18239  0   10 Apr28 ?        00:00:01 avnpython /awips/adapt/avnfps/OB8.3/py/avndis.py -d -n px2f
fxa      18239 18202 18252  0   10 Apr28 ?        00:00:25 avnpython /awips/adapt/avnfps/OB8.3/py/avndis.py -d -n px2f
fxa      18239 18202 18253  0   10 Apr28 ?        00:00:23 avnpython /awips/adapt/avnfps/OB8.3/py/avndis.py -d -n px2f
fxa      18239 18202 18254  0   10 Apr28 ?        00:06:03 avnpython /awips/adapt/avnfps/OB8.3/py/avndis.py -d -n px2f
fxa      18239 18202 18255  0   10 Apr28 ?        00:00:03 avnpython /awips/adapt/avnfps/OB8.3/py/avndis.py -d -n px2f
fxa      18239 18202 18256  0   10 Apr28 ?        00:00:01 avnpython /awips/adapt/avnfps/OB8.3/py/avndis.py -d -n px2f
fxa      18239 18202 18259  0   10 Apr28 ?        00:00:00 avnpython /awips/adapt/avnfps/OB8.3/py/avndis.py -d -n px2f
fxa      18239 18202 18268  0   10 Apr28 ?        00:01:22 avnpython /awips/adapt/avnfps/OB8.3/py/avndis.py -d -n px2f
fxa      18239 18202 18271  0   10 Apr28 ?        00:04:27 avnpython /awips/adapt/avnfps/OB8.3/py/avndis.py -d -n px2f
fxa      18239 18202 18273  0   10 Apr28 ?        00:03:42 avnpython /awips/adapt/avnfps/OB8.3/py/avndis.py -d -n px2f
fxa      18250 18202 18250  0    1 Apr28 ?        00:00:55 avnpython /awips/adapt/avnfps/OB8.3/py/avnxs.py -d -n px2f
		

[Note]Note

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: /usr/bin/pkill -f avninit -u fxa
		

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: /usr/bin/pkill -f avndrs -u fxa
		

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