很实用的Shell脚本(实践版)

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

很实用的Shell脚本(实践版)

/erpHome/shell/old/$1/$2.zip.old

find . -mtime +7 | xargs nice -n 20 zip -qm /erpHome/shell/old/$1/$2_$DayOfWeek.zip # find . -mtime +7

Fi

archiveOld2.sh

. /erpHome/shell/setP.sh

export DayOfWeek=`date +"%u"`

if test "$#" -lt 1 || test -z "$1"

then

echo At least one argument needed.

exit

fi

if test ! -e "$ShellHome/old/$1"

then

cd $ShellHome/old/

mkdir -p $1

fi

if test ! -e "$ERPHome/$1"

then

echo "$ERPHome/$1" "does not exist" exit

fi

cd $ERPHome/$1

mv $ShellHome/old/$1_$DayOfWeek.zip $ShellHome/old/$1.zip.old

find . -mtime +7 -type f | xargs nice -n 20 zip -qm $ShellHome/old/$1_$DayOfWeek.zip #find . -mtime +7 -type f

archiveOldAll.sh

/erpHome/shell/archiveOld.sh

work/dr/engine jrprint

/erpHome/shell/archiveOld.sh work/de tmp /erpHome/shell/archiveOld2.sh public

backupLog.sh

echo `date` ": Backup the logs"

. /erpHome/shell/setP.sh

cd $ERPHome/waslogs

mkdir old/

mv std*_*.txt old/

mv $LOGHome/LOG_$DD.zip $LOGHome/LOG.zip.old

zip -qmr $LOGHome/LOG_$DD.zip `ls $ERPHome/waslogs | grep -Ev "std|FATAL_DEBUG.xml"`

ls -l $LOGHome/LOG_$DD.zip

echo `date` ": Backup the logs done."

backupWASAll.sh

. /erpHome/shell/setP.sh

cd /erpHome

#rename old backup file

echo "####" `date` "ERP program backup ####" #mv /wasbackup/WASBackup_"$DayOfWeek".tar /wasbackup/WASBackup_old.tar

rm -Rf /wasbackup/erpbak/WASBackup_"$DayOfWeek". tar

#backup ERP program

nice -n 20 tar -cf /wasbackup/erpbak/WASBackup_"$DayOfWeek". tar jln.ear/erp.war DIClient DIServer ThreadPool erpdata

ls -l /wasbackup/erpbak/WASBackup_"$DayOfWeek". tar

collectAudit.sh

. /erpHome/shell/setP.sh jln

audit shutdown

auditpr -v < /audit/trail | grep PROC_Execute > $LOGHome/AUDIT_$YYMMDD.txt mv /audit/trail $LOGHome/trail_$TT

gzip $LOGHome/trail_$TT

audit start

last | grep "$TT2" >

$LOGHome/LOGIN_$YYMMDD.txt

grep "$TT3" /var/adm/sulog > $LOGHome/SU_$YYMMDD.txt

cplogs.sh

export dd=`perl -e '@y=localtime(time()-86400); printf "%02d\n",$y[3];'`

cd /erpHome/shell/logs

mkdir /test/erplogs

cp ./LOG_"$dd".zip /test/erplogs

cpnmon.sh

cd /worktmp/nmon

export dd=`perl -e '@y=localtime(time()-86400); printf "%02d\n",$y[3];'`

export d=`date +%y%m`"$dd"

export HOSTNAME=`hostname`

export data="$HOSTNAME"_"$d"_"*"

ftp -n <

open 10.32.1.138

user nmon nmon

cd $HOSTNAME

put $data

bye

相关文档
最新文档