The sas.servers.mid script fails to pause correctly and returns "Cannot find/read the expected log file..." when starting WebAppServers


The sas.servers.mid midtier script does not pause correctly if the server.log file does not exist. Note that the issue occurs due to a timing issue and exists only in SAS® 9.4M7 (TS1M7) Rev 940_22w08 and later SAS 9.7M7 releases. The problem does not occur in SAS® 9.4M8 (TS1M8). If you encounter this issue, output from the script includes messages similar to the following:

Starting SAS Web App Server: SASServer1_1
(this can take a while)
   Cannot find/read the expected log file:
   /opt/sas/config/Lev1/Web/WebAppServer/SASServer1_1/logs/server.log
   proceeding to next server.

This script controls the starting and stopping of the SAS 9.4 middle tier and pauses to allow servers to start and initialize in the correct order. The script looks for the existence of the server.log file in the SAS WebAppServer logs directory (such as Lev1/Web/WebAppServer/SASServerX_Y/logs). If the server.log file does not exist, the script does not pause for the WebAppServer to initialize and immediately starts the next server in the chain. As a result of this behavior, the middle tier might not start correctly.

The sas.servers.mid script can also be called from the sas.servers script. So the issue can also surface when you run the sas.servers script.

Some customers routinely clear the WebAppServer logs directory to manage the logs that accumulate. If the SAS middle tier is started when the server.log file does not exist, the starting action creates this file so that subsequent start attempts are successful.

Workarounds

One workaround is to manually create an empty server.log file if the logs directory is ever cleared.

The preferred workaround is to modify the sas.servers.mid script to add a "touch server.log" line that ensures that this file will always exist. To implement this workaround, edit the sas.servers.mid script (after taking a backup) in the SAS-configuration-directory/LevN directory. Locate the block of code below:

for st in $RETRY_SERIES
      do
        if [ ! -r "$SASWEBAPPSRV_DIR/$SASWEBAPPINSTANCE/logs/server.log" ]; then
          echo "   Cannot find/read the expected log file:"
          echo "   $SASWEBAPPSRV_DIR/$SASWEBAPPINSTANCE/logs/server.log"
          echo "   proceeding to next server."
          return 1
        fi

Edit the block as follows:

for st in $RETRY_SERIES
      do
        if [ ! -r "$SASWEBAPPSRV_DIR/$SASWEBAPPINSTANCE/logs/server.log" ]; then
          touch $SASWEBAPPSRV_DIR/$SASWEBAPPINSTANCE/logs/server.log
           echo "   Created server.log file"
      fi