3. The AccuRev Server : Controlling Server Operation

Controlling Server Operation
AccuRev includes facilities for controlling the operation of the AccuRev Server, the Watchdog, and the AccuRev Database Server. The user interface varies by platform:
UNIX/Linux: the acserverctl command-line utility
Windows: the Services control panel
UNIX/Linux: ‘acserverctl’ Utility
If the AccuRev Server and the AccuRev Database Server are running on a UNIX/Linux machine, you can control its operation with the acserverctl script. This is a Bourne-shell script, located in the AccuRev bin directory. (It is based on the control script for the Apache Web server.)
The acserverctl script also controls the AccuRev Database Server. The AccuRev Server process is dependent upon the Database Server process; if it is not running the AccuRev Server will not start.
Note: by default, acserverctl assumes that AccuRev is installed at /opt/accurev. If this is not the case, you must run acserverctl in an environment where ACCUREV_BIN is set to the pathname of the AccuRev bin directory. For example:
env ACCUREV_BIN=/var/accurev/bin acserverctl ...
acserverctl provides a set of non-interactive commands. The format of each command is:
acserverctl <command-name>
(Omitting <command-name> is equivalent to executing acserverctl help.) The commands are:
dbstart
Start the Database Server process.
dbstop
Tell the Server, the Watchdog, and the Database Server processes to stop gracefully.
start
Start the Database Server (if it is not running), then start the Server and Watchdog processes.
stop
Tell the Server and Watchdog processes to stop gracefully.
dbstatus
Report whether the Database Server is running or not.
status
Report whether the Server is running or not.
pause
Tell the Server to stop accepting new requests from AccuRev clients.
resume
Tell the Server to start accepting new requests from AccuRev clients again.
dbrestart
Stop the Server and Watchdog processes, then restart the Database Server, the Server, and the Watchdog processes.
restart
Tell the Server process to stop gracefully; this allows the Watchdog to restart it. If the Watchdog is not running, a start or hardrestart is performed.
kill
Forcibly stop the Server and Watchdog processes. This is accomplished by sending a TERM signal to each process. The script gets the process-IDs from files acserver.pid and acwatchdog.pid, located in the site_slice directory. These files are written automatically when the processes are started.
hardrestart
Perform a kill, followed by a start.
help
Display an acserverctl command summary.
The various “tell a process” capabilities are implemented through server-control files. (See Server-Control Files below.)
Windows: ‘Services’ Control Panel
If the AccuRev Server and AccuRev Database Server are running as services on a Windows machine, you can control their operation from the Services control panel. In some versions of Windows, this control panel is in a subdirectory called Administrative Tools.
The context (right-click) menu available for the services includes these commands:
start
stop
pause
resume
restart
For descriptions of these commands, see UNIX/Linux: ‘acserverctl’ Utility above. The restart command brings down both the Server and the Watchdog, by performing a stop followed by a start. For the AccuRev Database Server, the start, stop, and restart commands perform the equivalent of the dbstart, dbstop, and dbrestart commands in acserverctl.
Server-Control Files
On all platforms, the AccuRev Server and Watchdog processes check, once per second, for the existence of several server-control files in the site_slice directory. The existence of the server-control file causes the process to perform a particular action. In most cases, the contents of the file are irrelevant; a zero-length file will do.
acserver.command.pause
(used by the pause server-control command) Tells the Server to stop accepting new requests from AccuRev clients. The Server completes transactions that are already in progress and logs its “paused” status to the log file. Then, it continues to run, but the only thing it does is monitor the acserver.command.pause file. When this server-control file is removed, the Server resumes normal operation.
This server-control file is not removed when a new Server process starts up. If the file exists, the Server starts up in the paused state.
acserver.command.shutdown
(used by the stop and restart server-control commands) Tells the Server to “finish up quickly” and exit. The Server immediately stops accepting new requests from AccuRev clients. It continues to work on transactions that are already in progress, but it aborts any transactions that are not completed within 10 seconds. Then, the Server exits.
If the Watchdog is running, it detects the Server’s shutdown and starts up a new Server immediately. Thus, this server-control file typically causes a Server restart. In any event, this file is automatically removed whenever a new Server process starts up.
If 10 seconds is not the appropriate interval for “finishing up quickly”, place another integer (such as 120) in the acserver.command.shutdown file. The Server exits when there are no more transactions to work on, or when the timeout interval has passed, whichever comes first.
acwatchdog.command.shutdown
(used by the stop server-control command) Tells the Watchdog to exit cleanly. When the Server detects that the Watchdog has exited, it exits also, just as if it had found an acserver.command.shutdown file (see above). In this case, however, there is no longer a Watchdog process, so no restart of the Server takes place.
This server-control file is automatically removed when a new Server process starts up.
acserver.command.taskkill
Use this capability only as a last resort. Typically, it is preferable to restart the entire AccuRev Server (which allows in-progress tasks to complete), rather than terminating just one of its worker threads.
To terminate a particular worker thread:
Go to the site_slice directory.
echo 42 > tempfile
mv tempfile acserver.command.taskkill
Using the mv (or move) command instead of the echo command to create the taskkill file prevents a race condition that might cause the server to see taskkill as an empty file.
Important! After terminating a thread, restart the AccuRev Server as soon as possible. This minimizes the likelihood that terminating the thread will cause a memory resource leak in the Server process, impairing overall system performance.

Micro Focus