Hyrax - Starting and stopping the BES
The besctl command
The besctl command is used to control the BES daemon. For Hyrax version 1.7 and earlier, this the only way to control the BES. Starting with Hyrax 1.8 (release data tentatively set for fall 2011) the Hyrax Admin Interface can be used to start and stop the BES once the master daemon is started using this command.
The most common uses of besctl
To start and stop the BES, use the besctl command. The besctl command has a number of options, but the most important are the start and stop arguments. To start the BES use:
besctl start
and to stop it, use:
besctl stop
The general form for the besctl command is:
besctl (help|start|stop|restart|status|pids|kill) [options]
where options are:
-i back-end server installation directory -c use back-end server configuration file CONFIG -d send debugging for CONTEXT to cerr or <filename> -h show the help information and exit -p set port to PORT -r bes.pid file stored in directory PID_DIR -s specifies a secure server using SLL authentication -u set unix socket to UNIX_SOCKET -v echos version and exit
These options are used only in special circumstances; of them all the -d option to turn on debugging is the most useful. The syntax for run-time debugging/diagnostic output is:
-d "<output sink>,<context 1>, ...,<context n>"
where a typical example would be:
-d "cerr,ascii,netcdf,besdaemon"
which would tell the daemon to send diagnostic output from the ASCII handler, the NetCDF handler and the BES daemon itself to the terminal's standard error output.
About each of the arguments to besctl
The besctl command accepts a total of seven arguments.
help
Display help information for the besctl command
start
Start the BES
stop
Stop the BES. This is a 'hard' stop and any active connections will be dropped.
restart
This is the same as using the stop and start commands separately. If you want to issue a 'soft' restart of Hyrax, use the Hyrax Admin Interface, which will be available in Hyrax 1.8.
status
This returns the master BES daemon process id number and the user id under which it is running.
pids
The BES is actually a collection of processes; use this argument to find the process id numbers for them all.
kill
Sometimes the stop or restart arguments don't work. Use this argument to stop all the processes. The stop command works by sending the TERM signal to the master BES daemon process which then sends that signal to all of the subordinate BES daemon processes, but processes can ignore this signal in certain circumstances. Using the kill argument to besctl sends the KILL signal to all of the processes; KILL cannot be ignored by a process, so this is certain to stop the server.
Now, you've built the new module and you've made any changes you want to make to the configuration file, so now you are ready to start the server.
When you installed the BES a BES configuration file was provided for you in the installation directories etc/bes directory called bes.conf. So, if you installed the bes in the default location, there will be a file /usr/local/etc/bes/bes.conf file. You can use this file, or you can copy this file and create a new one. If you create a new one, either set the environment variable BES_CONF to point to this new configuration file or use the -c option to besctl. This way, you can create different configurations and just point this environment variable to the one you want to use. If using csh:
% setenv BES_CONF /full/path/to/bes.conf
Or, if using sh or ksh:
% BES_CONF=/full/path/to/bes.conf % export BES_CONF
Or use the -c option to besctl -c <new_configuration_file>
And now, to run the new server simply type:
% besctl start
This should start the server, and you should now be ready to connect to it with the command line client. If you want to see some debug information while running the server daemon then then you can use the -d option, specifying either cerr
or the name of a file to dump debug information to. If you specify cerr
then debug information will be dumped to standard err:
% besctl start -d "cerr|<file_name>,all"
If you are having problems with your installation, or problems retrieving information from the server, we may need for you to run the server with the debug flag turned on, along with verbose logging information that can be turned on in the configuration file. The first parameter in the debug option (cerr) can be either cerr to dump the debug information to standard error, or the name of a file that debug information will be written to. The next parameters are a comma separated list of debugging context. by specifying 'all' you are wanting debug information from all components.
And if you want to specify a different configuration file:
% besctl start -c /path/to/configuration/file/my_bes.conf
To stop the BES simply type:
% besctl stop
This will send a signal to shut down the BES.