此指令集在預設的排程群組中建立 lnode(如果密碼映射中存在此類使用者的話為 other,否則為 root。)並且以郵件提醒系統管理員要將新的 lnode 移入排程階層中的適當位置。
#!/bin/sh
#
#ident "@(#)nolnode.sh 1.6 98/10/28 SMI"
#
# Copyright (c) 1998 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/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
cat <<-EOF | /usr/lib/sendmail root
Subject: New lnode created for "$USER"
Remember to change scheduling group and shares for
"$USER".
`limreport lname=='"'"$USER"'"' 'Currently in group "%s" with %d shares\\n' sgroupname cpu.shares`
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