Name

check_env.sh — Diagnostic script to check if AMPAC is set up correctly.

Description

This script was designed as a new diagnostic tool to help identify and solve the most common problems that might prevent AMPAC from running. This tool should be used as the first step in identifying problems and should be run by anyone having trouble running AMPAC. If AMPAC fails to run properly and this script fails to resolve the problem, then the output from this script (with the -v and -n options) should be included when contacting Semichem™ Customer Support.

Usage:

$AMPAC_DIR/bin/check_env.sh [-hgklntv]

options

-h or --help

Show only help information on script options and usage.

-g or --gaussian

Check only information about Gaussian installation (test 1a).

-k or --key

Check only information about ampac10.key (test 6).

-l or --libs

Check only information about AMPAC library environment (test 5, 7, 8, and 9).

-n or --nocolor

Turn off color and special formatting characters.

-t or --trial

Test only Ampac's ability to run a simple job (test 10).

-v or --verbose

Verbose output.

--noagui

Skip all tests for agui components.

Output:

Prior to performing any tests, check_env.sh displays information about the machine type, operating system, and environment variables.

The check_env.sh script performs the following tests:

1) Check that $AMPAC_DIR and $AGUI_DIR have been set.

These two environment variables are set by the script init_ampac.csh (for csh or tcsh shells) or init_ampac.sh (for sh, ksh, or bash shells). If the appropriate script has not already been sourced, then these two environment variables have not been set and check_env.sh will stop and will report that init_ampac.csh or init_ampac.sh needs to be sourced. (See Chapter 16, Package Administration for more details on how to source these initialization scripts.)

The script will also attempt to detect if Gaussian is present and available. If a suitable version is identified, the Gaussian version and associated environment variables are printed. If Gaussian is not detected but is available on the system, make sure that the Gaussian installation is properly initialized.

2) Verify that $AMPAC_DIR and $AGUI_DIR have been set correctly.

It is essential that the $AMPAC_DIR environment variable points to the base directory into which AMPAC has been installed. The check_env.sh script looks in the directory $AMPAC_DIR for the files init_ampac.csh and init_ampac.sh. If it does not find them, then $AMPAC_DIR is not set correctly and check_env.sh stops with an error message. The appropriate init_ampac.csh or init_ampac.sh file must be edited with the correct directory and sourced again to set those environment variables. (See Chapter 16, Package Administration for more details on how to edit these initialization scripts.) The $AGUI_DIR environment variable is similarly checked. Since the init_ampac scripts automatically set $AGUI_DIR to $AMPAC_DIR/agui, this test should never fail unless $AGUI_DIR is being corrupted elsewhere or the AMPAC installation has been corrupted.

3) Check that key executables and scripts are present and in the correct directories.

There are a number of executables (such as ampac.exe) and scripts (such as ampac.sh) that must exist and be located in the correct directory for AMPAC to be able to run. If the script reports, "AMPAC has not been configured for 32-bit versus 64-bit executables" (select operating systems only), then this problem can be successfully resolved by the user by executing the config_ampac.sh script as indicated in the error message. Otherwise, unless there is a serious problem in the installation, this test should never report a failure. Please note specifically which executables or scripts are missing and then contact Semichem™ Customer Support for help in resolving this issue.

4) Verify that file permissions have been set correctly for key executables and scripts.

After having already verified the existence of each of the critical executables and scripts, the check_env.sh script will check that each has the required read and/or execute permissions that are needed in order to run. Generally, these permissions are set once and for all just after installation by executing the script Set_File_Protection.sh. If check_env.sh indicates that the permissions have not been set correctly, then have the system administrator run Set_File_Protection.sh to correct this. (See Chapter 16, Package Administration for details.) If that fails to resolve the problem, contact Semichem™ Customer Support.

5) Verify that file permissions have been set correctly for any libraries accompanying AMPAC and AGUI.

For some operating systems, AMPAC is shipped with specific libraries that AMPAC and AGUI need in order to run. These libraries (if any) are found in $AMPAC_DIR/lib and $AGUI_DIR/lib respectively. The user must have read and execute privileges for these libraries in order to run. If not, the user may receive a missing library error at run time even though the libraries are actually there. If running check_env.sh indicates that the permissions are not correct, then have the system administrator run Set_File_Protection.sh to correct this. (See Chapter 16, Package Administration for details.) If that fails to resolve the problem, contact Semichem™ Customer Support. If the script reports, "AGUI libraries have not been configured for Xft versus no Xft." (select operating systems only), then this problem can be successfully resolved by the user by executing the config_ampac.sh script as indicated in the error message.

6) Check that ampac10.key exists and is in the correct location.

The single most common reason for AMPAC not running is that the AMPAC license file (called ampac10.key) does not exist, has the wrong name, or has been placed in the wrong directory. This file does not come with the AMPAC installation but must be obtained directly from Semichem™. The file must be named ampac10.key and placed in the main AMPAC installation directory (i.e. $AMPAC_DIR). (See the section called “License Administration” for details.) The ampac10.key file also requires read permissions for any user of AMPAC or AGUI. Since ampac10.key is installed separately from the main AMPAC installation, its permissions may not have been properly set. If output from running the check_env.sh script indicates that the permissions are not correct, then have the system administrator run Set_File_Protection.sh to correct this. After checking that the ampac10.key file exists and has read permission, the check_env.sh script makes a quick check to verify that ampac10.key does indeed appear to be a genuine key. If that test fails, you will be required to contact Semichem™ Customer Service to get a new key. If all is successful, check_env.sh will call keycleaner -l to output information about the key file. (See keycleaner for details about this output.)

7) Check the ld_env.csh script and run-time load library paths.

AMPAC and AGUI must be able to load various libraries in order to run. The operating system locates these libraries by looking at a operating system specific run-time load library path variable (such as $LD_LIBRARY_PATH). The run-time load library path variables are modified by the script ld_env.csh, which is automatically sourced by the scripts that actually run AMPAC and AGUI. (It is done this way, so that changes to the run-time environment affect only the shell running AMPAC or AGUI. This avoids cluttering the user’s shell environment and helps avoid conflicts with other programs running on the system.) The contents of the library paths are reported in the output to insure that these paths are being set correctly.

8) Use ldd (or its equivalent) to print the list of required libraries, their locations, and if a library is missing.

The check_env.sh script will attempt to run ldd (or its equivalent) on ampac.exe. (If ldd or its equivalent cannot be found, this test will be skipped.) This will cause a list of needed run-time libraries to be dumped to the screen as well as information about whether the library has been found and if so, where it is located. The exact content and format of the output varies between operating systems. The user should check this output to see if any libraries are listed as missing or if are an older version. In the case of missing libraries, read the operating system specific README file located in $AMPAC_DIR/READMEs for detailed instructions on handling missing libraries. If that fails to resolve the problem, include the output from check_env.sh when contacting Semichem™ Customer Support.

9) Report how AMPAC is configured.

For diagnostic purposes, check_env.sh will output information about how AMPAC is configured. Which options require configuration depends on the operating system and some machines may have no configuration details to report. Reported configuration details may include: (a) using 64-bit or 32-bit executables; (b) using xft or non-xft dependent libraries; and (c) which version of the CXML library to use (EV4, EV5, EV6, or EV7). These configuration details can be changed by the user using the config_ampac.sh script. See config_ampac.sh for details about each of these configuration options and how to change them.

10) Attempt to run AMPAC and verify that it works correctly.

As a final test, the check_env.sh script will created a small AMPAC input file in the temporary directory, /tmp, and attempt to run it. This is the ultimate test to see if AMPAC is set up correctly. If there are problems with writing to /tmp or other problems, the script will simply give a warning and skip the AMPAC test. If AMPAC runs successfully, then everything is set up correctly. One possible cause for AMPAC to fail after it has passed all of the other tests is if the ampac10.key file has been corrupted during the process of emailing or file transferring. This problem can be corrected using the keycleaner utility. A second possible problem is that AMPAC cannot find a required library. Look through the output from ldd (from test 8, above) to see if it reports any missing libraries. In the case of missing libraries, read the operating system specific README file located in $AMPAC_DIR/READMEs for detailed instructions on handling missing libraries.