Shell script to implement simple timed database check and Mail

Source: Internet
Author: User
Shell script implements simple timed database check and email sending; ** iostest_kr1052 ** imop_tw_s11052 ** interval ** imop_tw_s31052 ** ko_kr_s11052 ** each shell script implements simple timed database check and email shell mysql mailvi ip.txt # iostest_tw = 10. 52. *. * # iostest_kr = 10. 52. *. * imop_tw_s1 = 10. 52. *. * imop_tw_s2 = 10. 52. *. * imop_tw_s3 = 10. 52. *. * ko_kr_s1 = 10. 52. *. * # run crontab-e 00 10 ***/root/action_shell/export at every day. sh>/root/action_shell/mail. log #! /Bin/sh last_data =$ (date-d last-day + % Y _ % m _ % d ); cat/dev/null> $ last_data.date for s_ip in $ (awk-F = '{print $0}'/root/action_shell/ip.txt ); do echo ================================== start to do task ==== ========================================================== =========; s = $ (echo $ s_ip | awk-F = '{print $1 }'); ip = $ (echo $ s_ip | awk-F = '{print $2 }'); echo '===================================' $ S' _ level_top_10 ============== ======================================== '> $ last_date.data out1 = $ (mysql-h $ ip-u ***-p ***-Dgen_log-E' select id, account_id, account_name, char_id, char_name, max (level), from_unixtime (createTime/1000) from pet_level_log _ '$ last_data' group by account_id order by max (level) desc, createTime limit 10; '>>/ root/action_shell/$ last_date.data ); echo '=================================' $ S' _ frist_to_pass_zhangliao_10 ======== ======================================== '> $ last_date.data out2 = $ (mysql-h $ ip-uxxx-pxxxx-Dgen_log-E' select id, log_time, account_id, char_id, account_name, char_name, param from property_change_log _ '$ last_data' where SUBSTRING (param, 13) = 1297 order by id limit 10; '>>>/root/action_shell/$ last_date.data); echo $ out1; echo $ out2; sleep 10 echo ============================== send mail successfully ==== ========================================================== =========; done/bin/mail-s 'from games.asia team tech' _ $ last_data wu_tong@renren-inc.com mingming.wang@renren-inc.com yongliang.yang@renren-inc.com yuesong.pu@renren-inc.com </root/action_shell/$ last_date.data
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.