MSSVR message storage Module History Packaging weight Adjustment script

Source: Internet
Author: User

    1. Php

<?phpdate_default_timezone_set ("PRC"); Require (DirName (__file__). ' /.. /.. /config/config.php '); $md 5_from_user=md5 ($_server[' remote_addr '].$_cookie[' uname '). $cookie _token); if ($_cookie[') Userip '] !=  "$MD 5_from_user") {        setcookie ("uname", NULL );         setcookie ("Userip", NULL);         header ("Status: 302 moved temporaly", true,302);         echo  "<script language=javascript>window.parent.location= '/kcgi-bin/publish/ index.php ';</script> ';         exit;} Function log_write_file ($user, $user _ip, $sel _ip= "None", $pack _right= "None") {         try{                  $timenow =date ("Y-m-d h:i:s", Time ());                  $daynow =date ("y-m-d", Time ());                  $fhandle =fopen ("logs/ Operation_pack_right.log. $daynow "," a ");                 fwrite ($fhandle, $timenow. "|". $user. "|". $user _ip. "|". $sel _ip. "|". $pack _right. " \ n ");                 fflush ($ Fhandle);                 Fclose ($fhandle);        }         catch (exception  $e) {                 echo  $e;        }         return 0;}? ><! doctype html public  "-//w3c//dtd xhtml 1.0 transitional//en"   "HTTP// Www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

2. SHELL

#!/bin/bashuser_no=$ (id |grep -p  "Richmail|root"  ) if [[  -z  $USER _no  ]] ; then     echo  " run must in richmail  user "    exit 1 fitime=$ (date " +%y%m%d%h%m%s ") DATE=$ (date " +%Y-% m-%d ") Export path=/bin:/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin :/sbin:/root/bin:/usr/local/bin/: $PATHexport  ld_library_path=:/home/richmail/oracle_client/lib:/home/ Richmail/lib:/home/richmail/oracle_client/lib:/home/richmail/libexport richmail_home=/home/richmailhost_ Conf=/home/richmail/newconf/hosts.confhost_bak_dir=/home/scripts/hostconf_bak/logfile=${host_bak_dir}/logs/ms_ Change_packlog.${date} #HOST_CONF =/tmp/hosts.conf#host_bak_dir=/tmp/hostconf_bak/#LOGFILE =${host_bak_dir}/logs/ change_packlog.${date}if [ $# != 2 ];then         echo  "USAGE:$0 the two parameter "        echo " usage:$0  Incoming parameters digit 1 or 3 or 5 or 7: "         echo  "usage:$0 all_9qi| [192.168.220.1-38] 3 "        exit 1;fiip_ms=$1pack_r=$2if  [[  "$IP _ms"  ==  "Check"   &&  "$PACK _r"  ==  "Query"  ]]; then        sed -rn  '/^ip=192.168.220.1/,/cloud-ms-38\/ logreport/p '    $HOST _conf|awk  ' {if ($0~/^ip=192.168.220./) {if (int (substr ($0,16)) <=38) {printf   "%s ", $0;flag=1}};if ($1~/pack_thread_num/ && flag==1) {printf  "%d\n", $ A}} '         echo  "End of query"          exit 0fi if [[  ! -d&nbsP;${host_bak_dir}  ]] ;then     mkdir -p   ${host_ bak_dir}    chown richmail.richmail  ${host_bak_dir}fi if [[    ! -d ${host_bak_dir}/logs ]] ;then     mkdir  -p  ${host_bak_dir}/logs    chown richmail.richmail  ${host _bak_dir}/logsfi cp -avpr  $HOST _conf   ${host_bak_dir}/hosts.conf.${time}    >>  $LOGFILEchown  richmail.richmail  $LOGFILEif  [[ $?  -ne  0 ]] ;then    echo  "$TIME  cp error, script   quit !   ">>   $LOGFILE    exit 1 fi echo " $ time   pack_thread change   $IP _ms  $PACK _r "   >> $ logfileif [[ "$IP _ms"  ==  "All"  ]] ;then        # sed  -ri  '/^ip=192.168.220.1/,${/\bpack_thread_num\b/{s/ =.*/ =  ' "$PACK _r" '/g}} '   $HOST _ conf        sed -ri  '/^ip=192.168.220.1/,/cloud-ms-38\/ logreport/{/\bpack_thread_num\b/{s/ =.*/ =  ' "$PACK _r" '/g}} '   $HOST _conf         diff  $HOST _conf  ${host_bak_dir}/hosts.conf.${time}         # sed -rn  '/^ip=192.168.220.1/,${/\bpack_thread_num\b/{s/  =.*/ =  ' $PACK _r '/gp} '   $HOST _conf >>  $LOGFILE           echo 5 | /home/richmail/bin/confutil;echo 0             for ((i=1;i<=38;i++));     do         echo y | /home/richmail/bin/richmail --sys-restart   192.168.220.${i} mssvr >>  /home/scripts/logs/ms_change_pack.log.${date} 2> &1        echo y | /home/richmail/bin/richmail  --sys-restart  192.168.220.${i} mssvr          echo  "All: 192.168.220.${i} restart"     done          diff  $HOST _conf  ${host_bak_dir}/hosts.conf.${time} >>   $LOGFILE      #sed  -rn  '/^ip=192.168.220.1/,${/\bpack_thread_num\b/{s/  =.*/ =  ' "$PACK _r" '/gp}} '   $HOST _conf >>  $LOGFILE          exit 0 else        if [[ -z  $ (echo  $IP _MS|GREP&NBSP;-P&NBSP; " ^192\.168\.220\. ([1-9]|1[0-9]|2[0-9]|3[0-8]) $ ")   ]];then                 echo  "parameter not right   all_9qi| [192.168.220.1-38] ";                 exit 1;        fi          #IP_MS_PLUS = "192.168.220." $ ((${ip_ms##*.} +1))         ip_ms_plus=$ ((${ip_ms##*.} +1))         echo  "${ip_ms}iiiiii${ip_ms_plus}"          sed -ri  '/^ip=\b ' "${ip_ms}" ' \b$/,/^ip=192.168.220.\b ' ${ip_ms_plus} ' \b$ /{/\bpack_thread_num\b/{s/ =.*/ =  ' "$PACK _r" '/g}} '   $HOST _conf         diff  $HOST _CONF&NBSP;&NBSP;${HOST_BAK_DIR}/HOSTS.CONF.${TIME}&NBSP;&Nbsp;      echo 5 | /home/richmail/bin/confutil;echo 0         echo y | /home/richmail/bin/richmail -- sys-restart   $IP _ms mssvr        echo  "restart  ${ip_ms} "        diff  $HOST _conf  ${host_bak_dir} /hosts.conf.${time} >>  $LOGFILE      exit 0 fi

This article from "Crooked Boy Good Heart" blog, please be sure to keep this source http://iamxiao.blog.51cto.com/6530374/1632888

MSSVR message storage Module History Packaging weight Adjustment script

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.