UNIX shell script for my work

#--------------------------------------------------------------------
# Housekeeping script for YPS tables and logfiles
#--------------------------------------------------------------------

# ======================================
# Housekeeping of $YPSFILES directory
# Run on first day of the month on 5 am - 6 am
# ======================================
# (a) remove any records in /opt/dct/relfiles/yps/archive if it is more than 6 months old
# (b) remove any records in /opt/dct/relfiles/yps/tmp (except statistic, static, arhive)
# if it is more than 1 month old
# (c) housekeep log files in /opt/dct/relfiles/yps/data and admin directory
# up to four generations only

0 5 1 * * find /opt/dct/relfiles/yps/archive -mtime +180 -exec rm {} \;
30 5 1 * * find /opt/dct/relfiles/yps/tmp -mtime +2 -exec rm {} \;
0 6 1 * * /opt/dct/rel/yps/scripts/arch.data.admin.cron > /dev/null

# ======================================
# Housekeeping of all YPS tables
# (except yx_imp_cntr, yx_voy, yx_cntr_yd_range)
# Run on 7:00 am every day
# ======================================
#
0 7 * * * echo "/opt/dct/rel/yps/scripts/arch.all.tab.cron"|/bin/csh >> /opt/dct/relfiles/yps/admin/crontab.log

# ======================================
# Housekeeping of other YPS tables
# (i.e. yx_imp_cntr, yx_voy, yx_cntr_yd_range)
# Run on 7:30 am every day
# ======================================
#
30 7 * * * echo "/opt/dct/rel/yps/scripts/arch.import.vsl.cron"|/bin/csh >> /opt/dct/relfiles/yps/admin/crontab.log

# ======================================
# Housekeeping of YPS tables
# ======================================
# Run on 8:00 am every day
0 8 * * * echo "/opt/dct/rel/yps/scripts/arch.unknown.vsl.cron"|/bin/csh >> /opt/dct/relfiles/yps/admin/crontab.log
# HouseKeeping yx_actual_cntr every day
0 2 * * * /opt/dct/rel/yps/scripts/clearyx_actual_cntr.sc

# ======================================
# Housekeeping of DCMS Monitor
# ======================================
#
0,15,30,45 * * * * /opt/dct/rel/dcms/monitor/monitorall.sc /opt/dct/relfiles/dcms/monitor/monitor.log
0 0 * * * /export/home/ctadmin/bin/clearrelfiles.sc
0 1 * * * echo "/opt/envy/client/bin/visualworks /opt/dct/rel/ops/bin/reconcileyardstack.im ALL" | /bin/csh >> /opt/dct/relfiles/yps/admin/reconcileyardstack.log
#0 1 * * * /opt/envy/client/bin/visualworks /opt/dct/rel/ops/bin/reconcileyardstack.im ALL >> /opt/dct/relfiles/yps/admin/reconcileyardstack.log
0 4 * * * /opt/dct/rel/dcms/monitor/housekeepmonitorlog.sc

# ======================================
# Housekeeping citos_evt_log
# ======================================
30 2 * * * /opt/dct/rel/system/bin/housekeepeventlog.sc
#------------------------------------------------------------
# Housekeeping script for BPS tables and logfiles
#------------------------------------------------------------
#
# Housekeeping of BPS tables
# Run on first day of the month on 6 am
# ======================================

# disable until housekeeping duration is confirmed
#0 6 1 * * /opt/dct/rel/bps/baes/bin/cron_hkp_baesDB.sc >/dev/null
#
#
# Housekeeping of program log file
# Run on 7 am every Sunday=0 .
# ==============================
0 7 * * 0 /opt/dct/rel/bps/baes/bin/housekpFiles.sc > /dev/null

# ======================================
# Housekeeping of reconcilling yardstack
# ======================================
#
0 1 * * * csh -c '/opt/envy/client/bin/visualworks /opt/dct/rel/ops/bin/reconcileyardstack.im ALL' >> /opt/dct/relfiles/yps/admin/reconcileyardstack.log
#0 3 * * * csh -c '/opt/envy/client/bin/visualworks /opt/dct/rel/ops/bin/reconcileyardstack.im ALL' >> /opt/dct/relfiles/yps/admin/reconcileyardstack.log

# ======================================
# Restart Application Server every week
# ======================================
#
#0 1 * * 0 /home/ctadmin/bin/killcitos_process.sh;/home/ctadmin/bin/resetandresyncpo.sc;/home/ctadmin/bin/startall


# ======================================================================
# Housekeeping BPS and SYSTEM directory after EDI&Portnet Upgrade 200103
# ======================================================================
#
0 5 * * * find /opt/dct/relfiles/bps/baes/data/basender/xml_file -mtime +6 -exec rm {} \;
1 5 * * * find /opt/dct/relfiles/bps/baes/data/basender/log_file -mtime +6 -exec rm {} \;
2 5 * * * find /opt/dct/relfiles/bps/baes/data/codes_rcvr -mtime +6 -exec rm {} \;
3 5 * * * find /opt/dct/relfiles/bps/baes/data/bth_appln_rcvr -mtime +6 -exec rm {} \;
4 5 * * * find /opt/dct/relfiles/bps/baes/data/dcms2mq_dispatcher/logfiles -mtime +6 -exec rm {} \;
5 5 * * * find /opt/dct/relfiles/bps/baes/data/dcms2mq_dispatcher/xml/sent -mtime +6 -exec rm {} \;
6 5 * * * find /opt/dct/relfiles/bps/baes/data/opern_jobs_rcvr/log -mtime +6 -exec rm {} \;
7 5 * * * find /opt/dct/relfiles/bps/baes/data/vsl_particulars_rcvr -mtime +6 -exec rm {} \;
8 5 * * * find /opt/dct/relfiles/bps/baes/data/vsl_reacvn_rcvr -mtime +6 -exec rm {} \;
9 5 * * * find /opt/dct/relfiles/bps/baes/data/vsl_schd_rcvr -mtime +6 -exec rm {} \;
10 5 * * * find /opt/dct/relfiles/system/cntr/PlngCntrDtlAdapter/Log -mtime +6 -exec rm {} \;
11 5 * * * find /opt/dct/relfiles/system/mqc -mtime +6 -exec rm {} \;
12 5 * * * find /opt/dct/relfiles/edi/logs -mtime +15 -exec rm {} \;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
一直很喜欢写unix shell script, 因为写那么一点点东西可以有那么多效果,投入小,产出大,爽啊. 在写IBM AIX K Shell script时,感觉不那么友好,主要是有一些格式细节要求比较严格,不太习惯,后来写惯了也就好了,下面的三个script是我为公司最近写的 一个自动备份shell script,基本要求就是每天晚上23:00自动跑起来,看file system /health used space是否超过了 60%,超过了就压缩三个目录下的 .dat, .log.文件, 压缩方式是gzip(.gz),本来 bzip2(.bz)的压缩率比 .gz要大1.5倍左右, 因为考虑到要 用 zgrep工具直接在文件中search字符串,而且影盘容量足够大,所以也就用gzip了.我自己感觉这三个 k shell script基本上把 aix 的 k shell script的一些特性都覆盖到了,所以就用这个例子, 文本分析我用了awk, 没用 perl,因为用不上perl那些超强的extended regular expression分析,我就用了awk,附件中有个awk文件的例子,awk也可以做比较复杂的分析,但肯定没有perl那样强,主要是perl超级强大的extended regular expression分析. 但是如果你要OOP而且要复杂文本分析,我建议你用perl或者如果你用java你就可以用oro来做perl文本分析,我的一个附件是在java中用oro进行文本分析的代码片段. 先讲一讲 IBM AIX k shell script的一些注意事项吧: (1) 注意 if 中括号的间距 (2) 注意数据的等于和字符串的等于 (3) 注意 function的返回只能是数值而且返回的数值不能太大 (4) 注意怎样才能给一个数组赋值-用空格分隔的一串数据赋予一个数组 其他的flow control ( if , for, case等),没有什么太需要注意的,可用本例子 直接作参考.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值