几种监控用守时使命ITeye - 众发娱乐

几种监控用守时使命ITeye

2019年03月04日12时58分18秒 | 作者: 晗晗 | 标签: 监控,网络连接,进程 | 浏览: 1931



网络连接数监控:
echo "`date +\"%H:%M:%S\"`" /home/count/netstatmonitor/netmonitor.`date +%Y%m%d`
netstat -n |grep 7001| awk /^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]} /home/count/netstatmonitor/netmonitor.`date +%Y%m%d` 


监控进程是否存在并重启:
#!/bin/bash
echo /home/count/start/testOK.jsp
wget -q http://localhost:7001/templet/testOK.jsp -O /home/count/start/testOK.jsp 
#wget -q no-check-certificate https://localhost:8443/templet/testOK.jsp -O /home/count/start/testOK.jsp 
sleep 5
cd /home/count/start
size=$(ls -l | grep testOK.jsp | awk {printf $5})
zero=0
rightline=7
right=7
if [ $size -eq $right ]; then
 echo "`date +\"%H:%M:%S\"` sss is ok" /home/count/start/`date +%Y%m%d`.data
 rm -f /home/count/start/line
 echo "`date +\"%H:%M:%S\"` sss is not ok" /home/count/start/`date +%Y%m%d`.data
 process=$(ps -ef | grep tomcat | grep -c sss)
 if [ $process -gt $zero ]; then
 echo 1 /home/count/start/line
 linenum=$(wc -l /home/count/start/line | cut -c 1)
 if [ $linenum -gt $rightline ]; then
 rm -f /home/mecp/count/start/line
 num=$(ps -ef | grep tomcat | grep sss | head -n 1 | awk {printf $2})
 kill -9 $num
 sleep 10
 num=$(ps -ef | grep tomcat | grep -c sss)
 if [ $num -gt $zero ]; then
 num=$(ps -ef | grep tomcat | grep sss | head -n 1 | awk {printf $2})
 kill -9 $num
 sleep 10
 . /home/sss/setenv.sh
 /home/tomcat-6.0.32/bin/startup.sh
 else
 rm -f /home/count/start/line
 . /home/setenv.sh
 /home/tomcat-6.0.32/bin/startup.sh
fi



做时刻同步:
[root@sss ~]# crontab -l
*/30 * * * * /usr/sbin/ntpdate 40.40.40.100



履行sql操作
#!/bin/bash
v_date=$(date +%Y%m%d);
/oracle/product/10.2.0/bin/sqlplus -s name/passwaord@sid EOF
set pages 0
set feed off
set heading off;
set feedback off;
set verify off;
set trimout on;
set trimspool on;
set trims on;
set linesize 4000;
set pagesize 4000;
spool /home/resourcesub_points_rec_$v_date.csv
SELECT 1||,||trim(DONEDATE)||, FROM ponitsinfo where substr(donedate,0,8) =(select to_char( dt ,YYYYMMDD) dt from (select sysdate-1 dt from dual));
spool off
EOF
版权声明
本文来源于网络,版权归原作者所有,其内容与观点不代表众发娱乐立场。转载文章仅为传播更有价值的信息,如采编人员采编有误或者版权原因,请与我们联系,我们核实后立即修改或删除。

猜您喜欢的文章

阅读排行

  • 1

    (转)sshdITeye

    运用,设定,这个
  • 2

    几种监控用守时使命ITeye

    监控,网络连接,进程
  • 3

    Ubuntu下装置php扩展ITeye

    装置,扩展,办法
  • 4
  • 5
  • 6
  • 7

    浅谈https\ssl\数字证书(2)ITeye

    证书,数字证书,客户端
  • 8
  • 9
  • 10