#!/bin/sh
time=`date +%Y/%m/%d-%H:%M`
usernumber=`who | wc -l`
user=`who |awk ‘{print $1}‘`
info_path=/data0/script/login/info
num_path=/data0/script/login/num
numcat=`cat ${num_path}`
server=`hostname`
if [ ${usernumber} -eq 0 ];then
echo 0 > ${num_path}
fi
if [ ${numcat} -eq 0 -a ${usernumber} -ge 1 ];then
###发送内容
echo "服务器:${server}\n用户:${user}\n登陆时间:${time}" > ${info_path}
###微信发送
/bin/sh /data0/script/weixin/all_wexin.sh server ${info_path}
echo 1 > ${num_path}
fi