Controlling Server Operation

AccuRev includes facilities for controlling the operation of the AccuRev Server, the Watchdog, and the AccuRev Database Server, as well as Mosquitto and Tomcat. 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 is running on a UNIX/Linux machine, you can control its operation with the acserverctl script. This is a Bash 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.

Beginning with release 7.6, acserverctl also controls the Mosquitto message broker and the Tomcat server, which hosts the WebUI, Pulse Code Review, and the AccuRev Git Server.

acserverctl provides a set of non-interactive commands. The format of each command is:

acserverctl <command-name> [<process>]

The <process> option (available in AccuRev versions 7.6 and higher) can be used for the start, stop, status, and kill commands. It specifies which process should be acted on. Possible values for <process> are:

accurev  Denote the AccuRev Server and Watchdog processes
db, or database Denote the Database Server
mq, mqtt, or mosquitto Denote the Mosquitto message broker process

tc, tomcat, or web

Denote the Tomcat process. (This is the only <process> value that can be used with the kill command.)
all Denote all the above processes

(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 specified <process> (or, by default, the Database Server (if it is not running), the Server, and Watchdog processes).

stop

Tell the the specified <process> to stop gracefully (the Server and Watchdog processes by default).

dbstatus

Report whether the Database Server is running or not.

status

Report whether the specified <process> is running or not (the Server by default).

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.

check

Available in AccuRev versions 7.6 and higher

Check disk space for …/accurev and find *.ndb and *.ndx files. These files are old AccuRev 4.x database files. Since they are not used by AccuRev 5.x, 6.x, or 7.x, they can be manually backed up and removed.

info

Available in AccuRev versions 7.6 and higher

Print out the following information:

  • AccuRev version

  • acclient.cnf and acserver.cnf files

  • Mosquitto version

  • Tomcat setting

  • git client version

  • Java version

  • accurev info

  • AccuRev server process information

  • License usage information

  • hostinfo

  • aclicense file

  • Process information

  • Connection Type (IPv4 or IPv6)

  • PostgreSQL Setting for shared_buffers and effective_cache_size

  • Transparent Huge Pages information

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.

Specify tc, tomcat, or web with the <process> option in order to forcibly stop only the Tomcat process.

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.)

Back to top

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 mapping between service names and AccuRev processes is as follows:

Service name AccuRev process
AccuRev DB Server Database Server
AccuRev Mosquitto Mosquitto message broker process
AccuRev Server AccuRev Server and Watchdog
AccurevTomcat Tomcat process, hosting the WebUI, Pulse Code Review, and AccuRev Git Server

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 the process 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.

Back to top

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.
  • Determine the ID number of the worker thread by examining the thread-status table (Tools > Server Tasks command).
  • Place the thread's ID number (e.g. 42) in the flag file:

    	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.

Note: 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.

Back to top