Chinaunix首页 | 论坛 | 博客
  • 博客访问: 25179
  • 博文数量: 11
  • 博客积分: 601
  • 博客等级: 上士
  • 技术积分: 120
  • 用 户 组: 普通用户
  • 注册时间: 2010-02-07 22:11
文章分类

全部博文(11)

文章存档

2010年(11)

我的朋友
最近访客

分类: LINUX

2010-03-03 01:09:31

/var/log $ cat /mnt/disk/sendip
#!/bin/bash

#start the eth1 service
#if [ `rc-status -C |grep net.eth1|awk '{print $3}'` = "started" ]; then
if `/etc/init.d/net.eth1 -s`; then
        echo "==net.eth1 started">> /tmp/sendip.date
else
        sudo /etc/init.d/net.eth1 restart
fi

#start the ppp0 service
#if [ `rc-status -C |grep net.ppp0|awk '{print $3}'` = "started" ]; then
if `/etc/init.d/net.ppp0 -s`; then
# or the following 2 lines is that same as this line
#if [ `rc-status -C |grep net.ppp0|awk '{print $3}'` = "started" ]
#then
        echo "==net.ppp0 started">> /tmp/sendip.date
else
        sudo /etc/init.d/net.ppp0 restart
fi

#start sshd service
#if [ `rc-status -C|grep sshd|awk '{print $3}'` = "started" ]; then
if `/etc/init.d/sshd -s`; then
        echo "==sshd started">>/tmp/sendip.date
else
        sudo /etc/init.d/sshd restart
fi

#start apache2 service
#if [ `rc-status -C|grep apache2|awk '{print $3}'` = "started" ]; then
if `/etc/init.d/apache2 -s`; then
        echo "==apache2  started">>/tmp/sendip.date
else
        sudo /etc/init.d/apache2 restart
fi

#start proftpd service
#if [ `rc-status -C|grep proftpd|awk '{print $3}'` = "started" ]; then
if `/etc/init.d/proftpd -s`; then
        echo "==proftpd  started">>/tmp/sendip.date
else
        sudo /etc/init.d/proftpd restart
fi

/sbin/ifconfig ppp0|grep 'inet addr:'|cut -d: -f2|awk '{print $1}'|mutt -s " `date \"+Send_IP: %Y/%m/%d %H:%M:%S\"` "
echo `/sbin/ifconfig ppp0|grep 'inet addr:'|cut -d: -f2|awk '{print $1}'`  `date`>>/tmp/sendip.date

阅读(917) | 评论(0) | 转发(0) |
0

上一篇:iptables

下一篇:让Linux系统防止syn攻击

给主人留下些什么吧!~~