Solaris Resource Manager 1.3 System Administration Guide

Default 'no lnode' Script

This script creates the lnode in the default scheduling group (other if such a user exists in the password map, otherwise root) and mails the system administrator a reminder to move the new lnode into the appropriate place in the scheduling hierarchy.

#!/bin/sh
#
#ident  "@(#)nolnode.sh 1.10 99/05/07 SMI"
#
# Copyright (c) 1998-1999 by Sun Microsystems, Inc.
# All rights reserved.
#
# Copyright 1995-1997 Softway Pty. Ltd.
#
# A script that called by the PAM module to create a lnode
#

PATH=/usr/srm/sbin:/usr/srm/bin:/sbin:/bin export PATH
LOCALE=C export LOCALE
if [ "$DEBUG" = "true" ]
then
    exec >> /tmp/nolnodelog 2>&1
    echo
    date
    echo "Attempting to create lnode for $USER"
else
    exec > /dev/null  2>&1
fi

err=`limadm set -u cpu.shares=1 "$UID" 2>&1`
if [ $? -eq 0 ]
then
    SRM_GROUP=`liminfo -v $USER | grep '^sgroupname' | awk '{ print $2 }'`
    SRM_SHARE=`liminfo -v $USER | grep '^cpu.shares' | awk '{ print $2 }'`
    export SRM_GROUP SRM_SHARE
    cat <<-EOF | /usr/lib/sendmail root 
	Subject: New lnode created for "$USER"

	Remember to change scheduling group and shares for
	"$USER". Currently in group "$SRM_GROUP" with $SRM_SHARE share.

EOF
else
    cat <<-EOF | /usr/lib/sendmail root
	Subject: Could not create lnode for "$USER"

	after "$SERVICE" attempt on tty "$TTY", uid "$UID", 
	rhost "$RHOST",
	limadm said "$err"
EOF
    exit 1 # deny access
fi
# permit access
exit 0