日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

中創(chuàng)信合的一個(gè)小程序,或許有用( 二 )


trap : 1 2 3
echo ""# skip a line
cat /etc/motd
trap "" 1 2 3
}# setting default attributes for terminal moved to ~/.profile, so
# each user has individual control over these characteristics# if not doing a hushlogin, check mailbox and news bulletins
if [ "X$HUSHLOGIN" != "XTRUE" ]
then
[ -x /usr/bin/mail ] &&{# if the program is installed
[ -s "$MAIL" ] &&
dspmsg $MF_ADM -s $MS_PROFILE $MSG_MAIL "nyou have mailn"
}
if [ "$LOGNAME" != "root" -a -x /usr/bin/news ]# be sure it"s there
then news -n
fi
fi

-su)
:

esac#trap 1 2 3lab=0
name=`who am I | awk "{print $1}"`
dev=`who am I | awk "{print $2}"`config_file=/etc/logport/loginfo
if [ ! -r $config_file ]
then
echo "沒有 $config_file 文件,請與系統(tǒng)管理員聯(lián)系 "
exit 1
fi#get line of config: guest tty63e 1234567 08 00 12 00
config_detail=`cat $config_file|grep $dev`
#echo $config_detail
#check detail, -z 檢查變量是否存在, 長度為零返回真
if [ -z "$config_detail" ]
then
echo "沒有設(shè)置用戶和用戶登錄時(shí)間限制參數(shù)!"else
config_user=`echo $config_detail|awk "{print $1}"`
config_term=`echo $config_detail|awk "{print $2}"`
config_week=`echo $config_detail|awk "{print $3}"`
config_start_hour=`echo $config_detail|awk "{print $4}"`
config_start_min=`echo $config_detail|awk "{print $5}"`
config_end_hour=`echo $config_detail|awk "{print $6}"`
config_end_min=`echo $config_detail|awk "{print $7}"`
#echo "config_user=" $config_user
#echo "config_term=" $config_term
#echo "name=" $name
#echo "dev=" $devif [ $config_user != $name ]
then
echo "ntThe user $name can not login on this port"
echo "nt 對不起,用戶 $name 不能登錄此端口"
echo "nt *********************************"
exit 1
elseww=`date%w`
# 得到當(dāng)前星期幾
aa=`date%H`
# 得到當(dāng)前時(shí)間的時(shí)值
bb=`date%M`
# 得到當(dāng)前時(shí)間的分值
hm=`expr $aa * 60$bb`
# 把當(dāng)前時(shí)間化成分值
lab=0
awk -v hm1="$hm" -v ww1="$ww""$3 !~ ww1 {exit 1} {stime=$4*60 $5; etime=$6*60 $7} {if(hm1< stime || hm1>etime) {exit 1}}" /etc/logport/loginfo || lab=1
if [ $lab -eq 1 ]
# 如果不在工作時(shí)間內(nèi)登錄則退出
then
echo "nt You must login in working time"
echo "nt 對不起,您必須在工作時(shí)間內(nèi)登錄此端口"
echo "nt ************************************"
exit 1
fifi
echo "nt 用戶 $name 登錄此端口"
echo "nt 您的工作時(shí)間為 $config_start_hour時(shí) $config_start_min分 至 $config_end_hour時(shí) $config_end_min分"
echo "nt ********************************************"fi
#awk -v name1="$name" -v dev1="$dev""$1 == name1 && $2 != dev1 {exit 1}" /etc/logport/loginfo || lab=1
#if [ $lab -eq 1 ]
# 和信息配置表中相應(yīng)字段對比
#then
#echo "ntThe user $name can not login on this port"
#exit 1
#fitrap 1 2 3在/etc目錄下建立一個(gè)logport目錄,將loginfo文件放入其中
loginfo文件內(nèi)容解釋如下
用戶名 所登錄的端口名 星期 開始登錄時(shí)間 結(jié)束登錄時(shí)間
root tty11 0123456 08 00 20 00
root tty01 0123456 07 00 23 00
root tty02 0123456 07 00 23 00
liaozp tty12 123456 08 00 20 00最后提醒大家要注意 loginfo文件的讀的權(quán)限

推薦閱讀