后台执行程序 nohup

nohup  /scripts/alert/sendMail_lsc.sh >/dev/null  2>&1  &

[root@centos7 alert]# cat sendMail_lsc.sh 
#!/bin/bash
#datetime=`date +%F' '%T`
while true
  do
  datetime=`date +%F' '%T`
  lscstatus=`nmap -Pn -p 3387 157.0.0.59 |grep 3387 |awk '{print $2}'`
  if [ "$lscstatus" != "open" ]
    then
    #mail  "leinw@bszhihui.com,baozw@bszhihui.com,zhangxg@bszhihui.com,zhaorr@bszhihui.com,wuhm@bszhihui.com" "立思辰_$subject" "$body"
    /scripts/alert/mail  "wuhm@bszhihui.com" "立思辰157.0.0.59远程端口3387没了" "发生时间: $datetime  远程IP: 157.0.0.59  问题: 3387远程端口扫描不开放" >/dev/null 2>&1
    if [ $? -eq 0 ]
      then
        exit
    fi
  fi
  sleep 600
  done
View Code

 

mail网盘链接:https://pan.baidu.com/s/1g6ufOLCRsTa3qRv0ylknjw
提取码:2mcw

posted @ 2019-05-17 16:52  mingetty  阅读(109)  评论(0)    收藏  举报