Shell script for sending LOG Category numbers via SMS

Source: Internet
Author: User

Copy codeThe Code is as follows :#! /Bin/bash
# Telno is used to query the number list file
# Sendsms. log is the text message sending result File
#1 indicates that the message is successfully sent.
Query_sms ()
{
> Submit_telno
> Delivered_telno
> Fail_delivered_telno
Cat telno | while read line
Do
# Determine which numbers in the telno file are successfully submitted --- save to submit_telno
Awk '{if ($1 =' $ line') print $0} 'sendsms. log> submit_telno
Done
# Determine which numbers in the telno file are successfully sent --- save to delivered_telno
Awk '{if ($2 = 1) print $0}' submit_telno> delivered_telno
# Finally, identify which numbers in the telno file fail to be submitted --- save to fail_submit_telno
Awk 'argind = 1 {a [$1]} ARGIND> 1 &&! ($1 in a) {print $0} 'delivered_telno telno> fail_delivered_telno
# Determine which numbers in the telno file are not successfully sent --- save to fail_delivered_telno
Awk 'argind = 1 {a [$1]} ARGIND> 1 &&! ($1 in a) {print $0} 'delivered_telno telno> fail_delivered_telno
}
Main ()
{
Query_sms
}
Main
Exit 0
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.