免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: mxin
打印 上一主题 下一主题

AIX shell工具集 [复制链接]

论坛徽章:
0
21 [报告]
发表于 2006-07-04 07:50 |只看该作者
[原创]16.监控oracle的表空间\r\n# mon_ts_space.sh\r\ncd  /home/oraprod\r\nsqlplus \"/as sysdba\" <<EOF\r\nset feed off;\r\nset heading off;\r\nspool /tmp/mon_ts_space.out;\r\n@mon_ts_space.sql\r\nexit\r\nEOF\r\ncat  /tmp/mon_ts_space.out|grep -v SQL|grep [0-9]|awk -f mon_ts_space.awk\r\n\r\n\r\n# mon_ts_space.sql\r\nselect\r\n   df.tablespace_name                          \"Tablespace\",\r\n   (df.totalspace - fs.freespace)              \"Used MB\",\r\n   fs.freespace                                \"Free MB\",\r\n   df.totalspace                               \"Total MB\",\r\n   round(100 * (fs.freespace / df.totalspace)) \"Pct. Free\"\r\nfrom\r\n   dba_tablespaces                               ts,\r\n   (select tablespace_name,\r\n        round(sum(bytes) / 1048576) TotalSpace\r\n      from dba_data_files\r\n      group by tablespace_name)                  df,\r\n   (select tablespace_name,\r\n        round(sum(bytes) / 1048576) FreeSpace\r\n      from dba_free_space\r\n      group by tablespace_name)                 fs\r\nwhere\r\n   ts.tablespace_name = fs.tablespace_name\r\nand\r\n   df.tablespace_name = fs.tablespace_name(+) \r\nand \r\nround(100 * (fs.freespace / df.totalspace)) <20\r\nand df.tablespace_name not in (\'APPS_UNDOTS1\',\'TEMP\');\n\n[ 本帖最后由 mxin 于 2006-7-5 08:23 编辑 ]

论坛徽章:
0
22 [报告]
发表于 2006-07-05 08:24 |只看该作者
[原创]17.只清除所有当前使用该vg的用户\r\n#kill_vg_user.sh\r\nif [ $# -le 0  ]  ;then \r\n echo \"no para, example:kill_vg_user.sh erpapp_vg \" \r\n exit\r\nfi\r\ndf -k|awk \'{print $7 }\'|grep -v Mounted >/tmp/fs_mounted.txt\r\nfor i in `lsvg -l $1 |grep -vE \"N/A|vg|MOUNT\"|awk \'{print $7}\'`\r\ndo\r\n if [ `grep -c $i /tmp/fs_mounted.txt`  -ge 1 ] ; then\r\n  echo fuser -kc $i\r\n   fuser -kc $i\r\n fi \r\ndone\n\n[ 本帖最后由 mxin 于 2006-7-5 09:01 编辑 ]

论坛徽章:
0
23 [报告]
发表于 2006-07-05 14:24 |只看该作者
看了以上的贴子,自己都不好意思将自己的脚本往上粘。惭愧呀。

论坛徽章:
0
24 [报告]
发表于 2006-07-07 09:14 |只看该作者
[原创]18.每月月底执行的脚本\r\n#month_lastday.sh\r\n. .profile\r\nTZ=TZ-24\r\necho `date +%d`\r\nif [ `date +%d` = \"01\" ]; then\r\necho \"ok. today is last day of this month. run it!\"\r\n#insert your shell scripts\r\nfi\r\n[原创]19.每月1日执行的脚本\r\n#month_firstdy.sh\r\n. .profile\r\nTZ=TZ+24\r\necho `date +%d`\r\nif [ `date +%d` = \"02\" ]; then\r\necho \"ok. today is firstday of  this month. run it!\"\r\n#insert your shell scripts\r\nfi\n\n[ 本帖最后由 mxin 于 2006-7-7 10:33 编辑 ]

论坛徽章:
0
25 [报告]
发表于 2006-07-19 10:21 |只看该作者
楼主太强了,--支持!

论坛徽章:
0
26 [报告]
发表于 2006-07-25 21:04 |只看该作者
真的好好哦,谢谢楼主。。。支持。。

论坛徽章:
0
27 [报告]
发表于 2006-07-26 13:28 |只看该作者
[原创]19.跟踪oracle export结果的脚本(放在exp脚本最后)\r\n#exp_check.sh\r\nif [ `tail /tmp/exp_dvlp.log|grep \" success\"|wc -l` -lt 1 ];then\r\n  echo   \"db dvlp export fail!!!\"  #报警\r\n  wall    \"db dvlp export fail!!!\"\r\nfi

论坛徽章:
0
28 [报告]
发表于 2006-08-27 15:29 |只看该作者
搂主辛苦了。希望搂主能把编写Shell的技巧与大家分享一下。

论坛徽章:
0
29 [报告]
发表于 2006-09-12 00:43 |只看该作者
好呀!!楼主真好人也!!

论坛徽章:
0
30 [报告]
发表于 2006-09-21 17:34 |只看该作者
20.检查系统的进程\r\na.check_proc.sh:\r\n\r\n#check_proc.sh\r\n cat check_proc.list|awk -F \",\" {\'print   \"Check_proc.sh  \"$1\" \\\"\"$2\"\\\"\" \"   \"$3 \'}|sh\r\n\r\n\r\nb.check_proc.list:(可修改)\r\n\r\ntelnet,telnetd -a,2 \r\nxcom,xcommanager.py,1\r\n\r\nc.Check_proc.sh:\r\n\r\n#Check_proc.sh \r\nexport LANG=en_US\r\ncount=`ps -ef|grep \"$2\"|grep -v grep|wc -l`\r\nif [ $count -lt $3 ];then\r\n    echo $1 has  not be started all,the number is $count/$3!\r\nfi\r\n\r\n\r\n\r\n\r\n运行示例:\r\n[test3][root][/home/mxin]>ps -ef            \r\n     UID    PID   PPID   C    STIME    TTY  TIME CMD\r\n    root      1      0   0   Aug 10      -  0:11 /etc/init \r\n    root  77910      1   0   Aug 10      -  5:53 /usr/sbin/syncd 60 \r\n    root 102470      1   0   Aug 10      -  0:00 /usr/ccs/bin/shlap64 \r\n    root 106572      1   0   Aug 10      -  0:00 /usr/lib/errdemon \r\n    root 139366      1   0   Aug 10      -  0:00 /usr/sbin/srcmstr \r\n    root 164068 139366   0   Aug 10      -  0:00 /usr/sbin/snmpd \r\n    root 184466 139366   0   Aug 10      -  4:38 /usr/sbin/aixmibd \r\n    root 246002      1   0   Aug 10   vty0  8:50 -ksh \r\n    root 409612 139366   0   Aug 10      -  0:05 sendmail: accepting connections \r\n    root 417830 139366   0   Aug 10      -  0:00 /usr/sbin/syslogd \r\n    root 421898      1   0   Aug 10      -  0:00 /usr/sbin/uprintfd \r\n    root 442602 782494   0 16:19:29      -  0:00 telnetd -a \r\n    root 446688 442602   0 16:19:29  pts/1  0:00 -ksh \r\n    root 466976 782494   0   Sep 07      -  0:00 ftpd \r\n    root 471108 139366   0   Aug 10      -  0:01 /usr/sbin/hostmibd \r\n    root 495680      1   0   Aug 10      -  0:04 /usr/sbin/cron \r\n    root 508018 139366   0   Aug 10      -  0:00 /usr/sbin/portmap \r\n    root 708686 782494   0   Sep 07      -  0:00 ftpd \r\n    root 729196 139366   0   Aug 10      -  0:04 /usr/sbin/snmpmibd \r\n    root 733290 139366   0   Aug 10      -  0:00 /usr/sbin/muxatmd \r\n    root 762026 446688   0 17:46:17  pts/1  0:00 ps -ef \r\n    root 782494 139366   0   Sep 07      -  0:00 /usr/sbin/inetd \r\n[test3][root][/home/mxin]>check_proc.sh     \r\ntelnet has not be started all,the number is 1/2!\r\nxcom has not be started all,the number is 0/1!\n\n[ 本帖最后由 mxin 于 2006-9-21 17:51 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP