ITPub博客

首页 > 数据库 > Oracle > 10.monitor web data script

10.monitor web data script

原创 Oracle 作者:tolilong 时间:2016-06-11 20:20:49 0 删除 编辑
定时监控网页数据的简单脚本

[mon@oracle6 ~]$ more /home/mon/source/mon_data
#!/bin/bash
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=xxxxxdb

res=`curl xxxx.xxxxx.xxx/xxxxxxxx | grep "xxxxxxxxxx" | grep "xx" | awk '{print $2}'`
datetime=`date +"%Y/%m/%d %H:%M:%S"`
echo $res
echo $datetime
$ORACLE_HOME/bin/sqlplus -S mon/mon << EOF
  insert into mon_data values('$datetime','$res');
  commit;
exit;
EOF


[mon@oracle6 ~]$ crontab -l
###############mon xxxxxx.xxx data################################
11 * * * * /home/mon/source/mon_data >> /home/mon/log/mon_data.log

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24237320/viewspace-2118598/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-07-13

  • 博文量
    406
  • 访问量
    1208665