- 论坛徽章:
- 13
|
if grep -a "COS" /etc/issue
then
if grep -a "reboot.sh" /etc/rc.local;then
CURDIR=`dirname $0`
echo "reboot.sh is write"
else
sed -i '$i'$CURDIR'/reboot.sh' /etc/rc.local
fi
fi
curcnt=`cat $CURDIR/file`
if [ $curcnt -gt 0 ];then
curcnt=$(($curcnt-1))
echo $curcnt > $CURDIR/file
cat /proc/uptime
date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S">>$CURDIR/time.log
/sbin/shutdown -r -t 20 #只适用于suse系统, 20秒后重起
# /sbin/shutdown -r 1 #用于ubuntu redhat cos系统
fi
问一下我这个脚本在cos,ubuntu,suse,redhat下没有问题为什么会在中标麒麟系统/etc/rc.local还会多出一个//reboot.sh这一行,第二个问题是当你用ps -ef | grep xxx ,能看得到这个脚本运行了,但是脚本里的命令没有执行, 中标系统问题多多啊 |
|