IBM Books

Administration Guide


Customizing the SP automounter function

The SP automounter function has been implemented so that you can optionally replace some or all of the SP automounter function with your own customization scripts. By placing executable files in the /etc/auto/cust directory, you can provide your own automounter function that will be executed in place of the SP automounter function. This is useful if you need to do things such as change the map file entry format for entries in the /u map file /etc/auto/maps/auto.u, change the default options for invoking the automount daemon, or completely replace the SP use of the automount daemon with some other automounter that you provide.

In order to use these customization scripts, the SP automounter support must be configured for your system (the amd_config site environment variable is set to true using the spsitenv command or SMIT panels). During the execution of the SP automounter function, a check will be made to see if any of the following files exist and are executable. If so, that file will be invoked in place of the corresponding automounter function:

/etc/auto/cust/cfgauto.cust
Configure the automounter directories and create default files as necessary

/etc/auto/cust/startauto.cust
Start the automounter daemon

/etc/auto/cust/refauto.cust
Refresh the automounter daemon

/etc/auto/cust/checkauto.cust
Verify the automounter configuration and daemon execution

/etc/auto/cust/mkautoent.cust
Add an entry to the automounter map file for user home directories

/etc/auto/cust/rmautoent.cust
Remove an entry from the automounter map file for user home directories

/etc/auto/cust/lsautoent.cust
List an entry from the automounter map file for user home directories

Each file is independent and any or all files may exist. The SP automounter function will be replaced only for those functions which have an executable customization script. Details on how each of these files will be used by the SP is provided in the following sections.

If the automounter function is to be replaced on all boot-install servers and processor nodes, the customization scripts must be distributed. If you have file collections configured for your system, these files will automatically be distributed through the user.admin file collection. If you are not using file collections, you must distribute these files to the boot-install servers and processor nodes using some other means.

The cfgauto.cust customization script

The /etc/auto/cust/cfgauto.cust file is an optional customization script that you may provide to configure the automounter directories and create default files. If this file exists, and it is executable, it will be invoked by the services_config installation command during the system boot process to configure your automounter installation. You should provide this file when you require a different automounter configuration than that provided by the SP. IBM suggests that your cfgauto.cust script create all directories and default files that are required by the automounter started by your /etc/auto/cust/startauto.cust script.

The services_config process will create the SP automounter log file as /var/adm/SPlogs/auto/auto.log. It will then check if cfgauto.cust exists and is executable, and if so, will invoke it. If not, the SP automounter configuration will be invoked using the /usr/lpp/ssp/install/bin/cfgauto installation script which creates the /etc/auto and /etc/auto/maps directories, and creates default /etc/auto.master master map and /etc/auto/maps/auto.u map files as necessary.

There are no input parameters passed to the cfgauto.cust script. The return value should indicate the following:

0
Success

non-0
A configuration problem occurred. In this case, the services_config process will not start the automounter daemon, but will continue with its other configuration functions.

Example

The following script is an example of a script you might use to configure directories and default files for a processor to use the Amd automounter instead of the AIX automount daemon:

#!/usr/bin/ksh
 
# Create /etc/amd directory
if [[ ! -a /etc/amd ]]; then
    mkdir /etc/amd
    if (($? != 0)); then
        echo "cfgauto.cust:  Cannot create directory /etc/amd."
      exit 1
    fi
fi
 
# Create /etc/amd/amd-maps dir
if [[ ! -a /etc/amd/amd-maps ]]; then
    mkdir /etc/amd/amd-maps
    if (($? != 0)); then
        echo "cfgauto.cust:  Cannot create directory /etc/amd/amd-maps."
       exit 1
    fi
fi
 
# Create default amd.u file with /defaults entry and an
# entry for the netinst userid
if [[ ! -a /etc/amd/amd-maps/amd.u ]]; then
    echo "/defaults rfs:=/homes/filesrv1;type:=nfs;sublink:=${key};
opts:=rw,hard,retry=3, timeo=40,rsize=4096,wsize=4096" >>
/etc/amd/amd-maps/amd.u
    if (($? != 0)); then
        echo "cfgauto.cust:  Cannot create default file
        /etc/amd/amd-maps/amd.u."
       exit 1
    fi
    echo "\nnetinst type:=link;fs:=/home" >> /etc/amd/amd-maps/amd.u
fi
 
# Set up /u so that Amd can handle mounts for amd.u map:
# No symbolic links allowed
if [[ -L /u ]]; then
    rm /u
    mkdir /u
fi
exit 0

The startauto.cust customization script

The /etc/auto/cust/startauto.cust file is an optional customization script that you can provide to start your automounter daemon. If this file exists, and it is executable, it will be invoked by the services_config installation command during the system boot process to start your automounter daemon. You should provide this file when you require changes to the SP invocation of the automount daemon, or when you wish to replace it with the invocation of a different automounter daemon that you have made available on your system.

The services_config process will invoke the automounter configuration, and if that completes successfully, a check will be made to see if startauto.cust exists and is executable. If so, it will be invoked to start the automounter daemon. If not, the automount daemon will be started using /etc/auto/startauto.

There are no input parameters passed to the startauto.cust script. The return value has no affect on the services_config execution.

Example

The following script is an example of a user customization script that you might use to start the Amd daemon instead of the AIX automount daemon. This script assumes that you have Amd installed on your system and that the executables reside in the /etc/amd directory.

#!/usr/bin/ksh
 
# Check if Amd daemon is running
if [[ -n 'ps -ef | grep /etc/amd/amd | grep -v grep' ]]; then
    echo "startauto.cust:  amd daemon is already running."
    exit 0
fi
 
# Build amd input list using all amd.* map files in
# /etc/amd/amd-maps directory
set -A amdmaps $(ls /etc/amd/amd-maps/amd.*)
let i=0
while (( $i < ${#amdmaps[*]} )); do
  amd_parms="$amd_parms /${amdmaps[$i]##/*/amd.}
${amdmaps[$i]}"
  let i=$i+1
done
 
# Start the daemon
nice --4 /etc/amd/amd -t 16.120 -x all -l /var/adm/SPlogs/auto/auto.log
$amd_parms
exit $?

The refauto.cust customization script

The /etc/auto/cust/refauto.cust file is an optional customization script that you can provide to refresh your automounter daemon. If this file exists, and it is executable, it will be invoked after a file collection update has been made to the /etc/auto/maps/auto.u map file for user home directories. You should provide this file when your automounter requires special refresh activity.

If you have file collections configured for your SP system, the supper update process on a boot-install server or processor node will update the /etc/auto/maps/auto.u map file when changes have been made. If this map file is updated, the automounter refresh is invoked. The refresh process will check to see if the refauto.cust customization script exists and is executable. If so, it will be invoked to refresh the automounter daemon. If not, no activity will occur since the automount daemon does not require refreshing.

If you are using file collections to distribute your map files and your automounter requires refreshing for updates to map files other than /etc/auto/maps/auto.u, you will need to update the list file for the collection. The user.admin collection is used to distribute all map files in the /etc/auto/maps directory. If you are also using user.admin to distribute your maps, you will need to edit the list file /var/sysman/sup/user.admin/list to contain an execute statement similar to the one for auto.u:

execute /etc/amd/refresh_amd (./etc/auto/maps/auto.u)

There are no input parameters passed to the refauto.cust script. The return value is noted by the supper update process.

Example

The following script is an example of a user customization script that you might use to refresh the Amd daemon. This script assumes that Amd is installed and that the executables reside in the /etc/amd directory.

#!/usr/bin/ksh
 
# If amd is running then refresh the maps with amq -f
if [[ -n 'ps -ef | grep /etc/amd/amd | egrep -v grep' ]]; then
  /etc/amd/amq -f
fi

The checkauto.cust customization script

The /etc/auto/cust/checkauto.cust file is an optional customization script that you can provide to verify your automounter installation. If this file exists, and it is executable, it will be invoked from the SYSMAN_test command to verify your automounter installation. You should provide this file when you have provided your own automounter configuration using /etc/auto/cust/cfgauto.cust or started your own automounter daemon with /etc/auto/cust/startauto.cust. IBM suggests that your checkauto.cust checks all files and directories required by your automounter and that your automounter daemon is running.

The SYSMAN_test process will check if /etc/auto/cust/checkauto.cust exists and is executable. If so, it will invoke it. If not, it will invoke the SP automounter verification. This code checks that all required SP automounter directories and files exist and that the SP automounter daemon is running.

The checkauto.cust script will be invoked with the same syntax as the SYSMAN_test command:

checkauto.cust [-q | -v] -l log_file

The parameters are those supplied to the SYSMAN_test command with the following definitions:

-q
Specifies quiet mode; error messages are only appended to the log file and not written to stdout.

-v
Specifies verbose mode; all error and informational messages are written to both the log file and stdout.

-l logfile
Specifies the path name of the log file to which messages are appended.

If neither -q nor -v are specified, error messages are written to both the log file and stdout.

The return value from checkauto.cust execution should be:

0
Indicates success

non-0
Indicates the number of verification errors that were found

Example

The following script is an example of a user customization script that you might use to verify your Amd configuration and daemon execution. This script assumes that Amd is installed and that the executables reside in the /etc/amd directory.

#!/usr/bin/ksh
 
while getopts "qvl:" opt; do
  case $opt in
      q ) QUIET="-q" ;;
      v ) VERBOSE="-v" ;;
      l ) LOGFILE=$OPTARG ;;
  esac
done
 
let ERRORS=0
# Check for /etc/amd directory
if [[ ! -a /etc/amd ]]; then
    if [[ -z $QUIET ]]; then
        echo "checkauto.cust:  Directory /etc/amd does not exist."
    fi
    echo "checkauto.cust:  Directory /etc/amd does not exist." >> $LOGFILE
    let ERRORS=$ERRORS+1
fi
 
# Check for /etc/amd/amd-maps dir
if [[ ! -a /etc/amd/amd-maps ]]; then
    if [[ -z $QUIET ]]; then
        echo "checkauto.cust:  Directory /etc/amd/amd-maps does not exist."
    fi
    echo "checkauto.cust:  Directory /etc/amd/amd-maps does not exist." >> $LOGFILE
    let ERRORS=$ERRORS+1
fi
 
# Check for default amd.u file
if [[ ! -a /etc/amd/amd-maps/amd.u ]]; then
   if [[ -z $QUIET ]]; then
       echo "checkauto.cust:  Map file /etc/amd/amd-maps/amd.u does not exist."
   fi
   echo "checkauto.cust: Map file /etc/amd/amd-maps/amd.u does not exist." >> $LOGFILE
   let ERRORS=$ERRORS+1
fi
 
# Check if /u is a symbolic link
if [[ -L /u ]]; then
    if [[ -z $QUIET ]]; then
       echo "checkauto.cust:  /u is a symbolic link.  Not allowed by Amd."
    fi
    echo "checkauto.cust:  /u is a symbolic link.  Not allowed by Amd." >> $LOGFILE
    let ERRORS=$ERRORS+1
fi
 
# Check if Amd daemon is running
if [[ -z 'ps -ef | grep amd | grep -v grep' ]]; then
    if [[ -z $QUIET ]]; then
        echo "checkauto.cust:  amd daemon is not running."
    fi
    echo "checkauto.cust:  amd daemon is not running." >> $LOGFILE
    let ERRORS=$ERRORS+1
fi
 
exit $ERRORS

The mkautoent.cust customization script

The /etc/auto/cust/mkautoent.cust file is an optional customization script that you can provide to add a user home directory entry to your automounter map file. If this file exists, and it is executable, it will be invoked by the SP User Management commands spmkuser, spchuser, and mkamdent either directly or through SMIT panels. You should provide this file when you require a different map file or map file format than that generated by the SP User Management services for the /etc/auto/maps/auto.u map file. If you do provide this file, you will probably also need to provide /etc/auto/cust/rmautoent.cust and /etc/auto/cust/lsautoent.cust. These files remove and list the user's home directory entry in the map file.

When SP User Management services process user home directory additions or updates, a check is made to see if mkautoent.cust exists and is executable. If so, it will be invoked to process the home directory information for your automounter map file. If not, the automount map file /etc/auto/maps/auto.u will be updated with the new home directory entry.

The Parallel Operating Environment (POE) component in the AIX Parallel Environment contains the command mpamddir which is dependent on the format of the SP supported automount map file. If you have this support installed on your system and are using the command, you may need to provide an additional user exit. See IBM Parallel Environment for AIX: Operation and Use for more information.

The mkautoent.cust script is invoked with the following syntax:

mkautoent.cust user host[,host...] pathname

The parameters have the following definitions:

user
The user name that is to be used as a key to the new map entry.

host[,host...]
One or more host names separated by commas indicating the target host where the user's home directory resides.

pathname
Directory path name of the user's home directory as it is defined on the host. The trailing user subdirectory has been removed from the path name.

For example, the syntax for a user jws with a home directory on luna with the path name of /home/luna/jws would be:

mkautoent.cust jws luna /home/luna

The return value from mkautoent.cust execution should indicate:

0
Success

non-0
An error occurred creating the map file entry. The following actions will occur:

Example

The following script is an example of a user customization script that you might use to add an entry to your /etc/amd/amd-maps/amd.u map file.

#!/bin/ksh
 
# get input parms
USER=$1
HOSTS=$2
HOMEPATH=$3
AMDMAP=/etc/amd/amd-maps/amd.u
HOSTS='echo $HOSTS | sed 's/,/ /g''
 
# Append the entry to the amd /u map
FIRST=" "
for HOST in $HOSTS; do
  if [[ -z $FIRST ]]; then
    echo "$USER  host==$HOST;type:=link;fs:=$HOMEPATH \\" >> $AMDMAP
    FIRST=$HOST
  else
    echo "host==$HOST;type:=link;fs:=$HOMEPATH \\" >> $AMDMAP
  fi
done
echo "host!=$FIRST;type:=nfs;rhost:=$FIRST;rfs:=$HOMEPATH" >> $AMDMAP

The rmautoent.cust customization script

The /etc/auto/cust/rmautoent.cust file is an optional customization script that you can provide to remove a user home directory entry from your automounter map file. If this file exists, and it is executable, it will be invoked by the SP User Management commands sprmuser and spchuser either directly or through SMIT panels. You should provide this file when you have provided /etc/auto/cust/mkautoent.cust support for a different map file or map file format than that generated by the SP User Management services for the /etc/auto/maps/auto.u map file.

When SP User Management services process user home directory removals, a check is made to see if rmautoent.cust exists and is executable. If so, it will be invoked to remove the home directory information from your automounter map file. If not, the entry will be removed from the automount map file /etc/auto/maps/auto.u.

The rmautoent.cust script will be invoked with the following syntax:

rmautoent.cust user

The parameters have the following definitions:

user
The user name that is used as the key of the map entry to be removed.

For example, the syntax for a user jws with a home directory on luna with the path name of /home/luna/jws would be:

rmautoent.cust jws

The return value from rmautoent.cust execution should indicate:

0
Success

non-0
An error occurred removing the map file entry. The following actions will occur:

Example

The following script is an example of a user customization script that you might use to remove an entry from your /etc/amd/amd-maps/amd.u map file.

#!/bin/ksh
 
# Get input parms
USER=$1
AMDMAP=/etc/amd/amd-maps/amd.u
 
# Delete the entry to the amd /u map
sed -e"/^$USER /,/[^\\]$/d" $AMDMAP > $AMDMAP.tmp
mv $AMDMAP.tmp $AMDMAP
exit 0

The lsautoent.cust customization script

The /etc/auto/cust/lsautoent.cust file is an optional customization script that you can provide to list a user's home directory information stored in your automounter map file. If this file exists, and it is executable, it will be invoked by the SP User Management command splsuser either directly or through SMIT panels. You should provide this file when you have provided /etc/auto/cust/mkautoent.cust support for a different map file or map file format than that generated by the SP User Management services for the /etc/auto/maps/auto.u map file.

The splsuser command checks to see if lsautoent.cust exists and is executable. If so, it will be invoked to list the home directory information from your automounter map file. If not, the information stored in the automount map file /etc/auto/maps/auto.u will be listed.

The lsautoent.cust script will be invoked with the following syntax:

lsautoent.cust user

The parameter has the following definition:

user
The user name that is used as the key of the map entry containing the home directory information to be returned.

The user home directory information should be echoed to stdout in the following format:

host[,host...]
pathname

where:

host[,host...]
Lists one or more host names separated by commas indicating the target host where the user's home directory resides.

pathname
Lists the directory path name of the user's home directory as it was provided to the mkautoent.cust script with the trailing user subdirectory removed from the path name.

For example, the syntax for a user jws with a home directory on luna with the path name of /home/luna/jws would be:

lsautoent.cust jws

and the return value written to stdout would be:

luna /home/luna

The return value from lsautoent.cust execution should indicate:

0
Success

non-0
An error occurred listing the map file entry. The splsuser command will list default user home directory information if the output from this script is null.

Example

The following script is an example of a user customization script that you might use to remove an entry from your /etc/amd/amd-maps/amd.u map file.

#!/bin/ksh
# Get input parms
USER=$1
AMDMAP=/etc/amd/amd-maps/amd.u
 
# Find the entry in the amd /u map and return the host and directory
hosts='cat $AMDMAP | sed "
/^$USER /,/[^\\]$/!d
/host==/!d
s/.*host==\(.[^; ]*\).*$/\1/g"'
hosts='echo $hosts | sed "s/\([^ ]*\)[ ][ ]*\(.[^ ]*\)/\1,
\2/"g'
home_dir='cat $AMDMAP | sed "
/^$USER /,/[^\\]$/!d
/rfs:=/!d
s/.*rfs:=\([^; ]*\)[^ ]*/\1/g"'
 
echo $hosts $home_dir
 
exit 0


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]