Check that a service produces a core file only sends 1 SMS, the same core does not send (shell)

Source: Internet
Author: User

Tag:function   message   online    SMS    

#!/bin/bash#--------------------------------------------------   #Created: 2015-04-27#author:jimmygong #Mail: [email protected] #Function: check core && send message#version:1.0#----- ---------------------------------------------set -o nounsetset -o errexitonlinedir= "/opt/ Online "tellist= (1234567891212345678913) function sendmessage  ()  {currdate=" $ (date +%Y/%m/%d ) "[email protected]ip= ' ifconfig eth1|awk  '/inet addr:/' |awk -f:  ' {print $2} ' |awk -f '   '   ' {print $1} ' for phone in ${tellist[@]}do     links -dump  "http://192.168.1.1/22222?mobile= $phone &msg= $currdate: $message: $ip &sign= 11111111111111111111111111111111 " > /dev/null 2>&1done}function checkcore ()  {num= ' ls -1  $onlinedir |grep  "^online" |wc -l ' for  ((k=1;k<=${num};k++)) do     lisTdir= ' ls -1  $onlinedir |grep  "^online" |sed -n  $k ' P '     for j  in  $onlinedir/$listdir &NBSP;&NBSP;&NBSP;&NBSP;DO&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;CD   $J         touch corefile         for m in core.*        do             if [[ -e  $m  ]]             then                     core=0                 for f in  ' cat  $j/ Corefile '                 do                     if [[  $m  =  $f  ]]                     then                         core=1                          break                     fi                 done                 if [[  $core  -eq 0 ]]                 then                     message= "Core"                      sendmessage  $message                                   echo  $m  >>  $j/corefile                 fi             fi        done     donedone}checkcoreexit 0============================ Description ================================= ===== directory Structure ll /opt/online/drwxr-xr-x 2 root root 4096 2015-04-27 18:20  online.11drwxr-xr-x&Nbsp;2 root root 4096 2015-04-27 18:20 online.22drwxr-xr-x 2 root  root 4096 2015-04-27 18:20 online.33touch /opt/online/online.11/ Core.111 will ll /opt/online/online.11/-rw-rw-r--. after executing the 1th script  1 root root 0 apr 27  22:05 core.111-rw-rw-r--.  1 root root 9 Apr 27 23:27  corefilecat /opt/online/online.11/corefile core.111 no longer sends text messages and writes to this corefile file for the 2nd time. [email protected] can also be written message= "" [email protected]               #所有的位置参数 (each as a separate string)   equals "$"   "$" ...  "$N". set -o nounset  #在扩展一个没有的设置的变量的时候, displaying incorrect information  set -o errexit  #如果一个命令返回一个非0退出状态值 ( Failed), exit. num= ' Ls -1 '     # -1  list one file per  Line effect ls -1 /opt/online/online.11online.22online.33 need to install links (apt-get&nbSp;-y install links or Yum -y install links) 

This article is from the "7928217" blog, please be sure to keep this source http://7938217.blog.51cto.com/7928217/1639520

Check that a service produces a core file only sends 1 SMS, the same core does not send (shell)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.