'Shell script'에 해당되는 글 8건

  1. 2012.05.23 sso 로그 파일 gzip 묶기
  2. 2010.10.20 shell 어제 날짜 구하기
  3. 2010.10.20 TSM 실행 결과 저장
  4. 2010.04.14 [Win] True image cmd script
  5. 2010.03.09 nmon.sh

#!/bin/ksh

 

cd /AUDITLOG/authlog/

ls|cut -c 0-35|uniq

 

echo " .. .. .. .."

echo " input Year"

read year

echo " input month"

read month

 

file=aznapi_webseald-default.log.$year-$month

 

echo $file

 

echo " tar log file "

tar -cvf /INSTPKG/backup/$file.tar $file*

 

usage=`df -m|grep INSTPKG|awk '{print $4}'|sed -e s/\%//`

 

if [ $usage -lt 100 ]

then

        cd /INSTPKG/backup

        echo " gzip tar file "

        gzip $file.tar

 

        usage1=`df -m|grep INSTPKG|awk '{print $4}'|sed -e s/\%//`

 

        if [ $usage1 -lt 100 ]

        then

                cd /AUDITLOG/authlog/

                rm -f $file*

        fi

fi

 

usage2=`df -m|grep INSTPKG|awk '{print $4}'|sed -e s/\%//`

echo " /AUDITLOG directory " $usage2"%"

'Shell script' 카테고리의 다른 글

shell 어제 날짜 구하기  (0) 2010.10.20
TSM 실행 결과 저장  (0) 2010.10.20
[Win] True image cmd script  (0) 2010.04.14
nmon.sh  (0) 2010.03.09
odm 저장 스크립트  (0) 2009.10.21
Posted by efrit
,
1. AIX 등 unix 에서
TZ=KST+15; date +%m%d

2. GNU date에서는 --date="1 day ago" 옵션을 주면 됩니다.

예제:  date +"%Y-%m-%d" --date="1 days ago"
       date +"%Y-%m-%d" --date="-1 day"
       date +"%Y-%m-%d" --date="last day"
       date +"%Y-%m-%d" --date="next Tuesday"

'Shell script' 카테고리의 다른 글

sso 로그 파일 gzip 묶기  (0) 2012.05.23
TSM 실행 결과 저장  (0) 2010.10.20
[Win] True image cmd script  (0) 2010.04.14
nmon.sh  (0) 2010.03.09
odm 저장 스크립트  (0) 2009.10.21
Posted by efrit
,
#!/bin/sh

dir=/INSTPKG/TSM.script/exe_sched


dsmadmc -id=admin -password=admin "q eve * * begind=-1"|egrep "Completed|Failed|Missed|Uncertain" > $dir/imsi
dsmadmc -id=admin -password=admin "q eve * * begind=-1" > $dir/log/$((`TZ=KST+15; date +%y%m%d`)).log

com=`grep Completed $dir/imsi|wc -l`
fail=`grep Failed $dir/imsi|wc -l`
miss=`grep Missed $dir/imsiwc -l`
unc=`grep Uncertain $dir/imsiwc -l`


echo $((`TZ=KST+15;date +%m%d`))"     Completed : "$com"    Failed : "$fail"    Missed : "$miss"    Uncertain : "$unc >> $dir/$((`TZ=KST+15;date +%y%m`))_sched.log

rm -f $dir/imsi

if [ 1 -eq $((`TZ=KST+15; date +%d`)) ];then

        cd $dir/log
        tar -cvf $((`TZ=KST+39;date +%Y%m`)).tar ./$((`TZ=KST+39;date +%y%m`))*

fi


'Shell script' 카테고리의 다른 글

sso 로그 파일 gzip 묶기  (0) 2012.05.23
shell 어제 날짜 구하기  (0) 2010.10.20
[Win] True image cmd script  (0) 2010.04.14
nmon.sh  (0) 2010.03.09
odm 저장 스크립트  (0) 2009.10.21
Posted by efrit
,

ech off

set today=date:~0,9%
set today=%today:-=%

set start_time=%time:~0,8%
set start_time=%start_time::=%

echo "=================================" >> C:\%today%.log
echo "백업을 시작합니다." > C:\%today%.log
echo %start_time% >> C:\%today%.log
echo " " >> C:\%today%.log

net use T: \\tco\OS_Backup

cd C:\Program Files\Acronis\TrueImageEchoServer

TrueImageCmd.exe /create /filename:"T:\fax2.tib" /partition:1-1 >> C:\%today%.log

set end_time=%time:~0,8%
set end_time=%end_time::=%

echo " " >> C:\%today%.log
echo %end_time% >> C:\%today%.log
echo "백업이 완료 되었습니다. " >> C:\%today%.log
echo " " >> C:\%today%.log

net use T: /delete /Y

'Shell script' 카테고리의 다른 글

shell 어제 날짜 구하기  (0) 2010.10.20
TSM 실행 결과 저장  (0) 2010.10.20
nmon.sh  (0) 2010.03.09
odm 저장 스크립트  (0) 2009.10.21
if 표현식  (0) 2009.10.16
Posted by efrit
,

nmon.sh

Shell script 2010. 3. 9. 14:36

###############################
#                                                           #
#     nmon 실행 스크립트                          #
#                                                           #
#                                  2010. 3. 9. JY       #
#                                                            #
###############################
#!/bin/sh

host=`hostname`
today=`date +%d`
month=`date +%m`
YEAR=`date +%Y`
year=`date +%y`

LASTMONTH=$((`echo $YEAR$month` - 1))
lastmonth=$((`echo $year$month` - 1))
LASTYEAR=$(($YEAR - 1))
lastyear=`echo $LASTYEAR|cut -c 3-`

bindir="/nmon/bin"
datadir="/nmon/data"

###### 어제 만든 nmon 파일 복사 ######
nmon_file=`echo $host*.nmon`
cd $bindir

if [ -f $nmon_file ]
then

   cp $nmon_file $datadir
   rm -f $nmon_file

fi

###### 매월 1일 지난달 파일 압축 ######
if [ 01 -eq $today ]
then
   cd $datadir 

 ## 1월을 빼고 나머지달에 지난달 파일 묶기
   if [ 01 -ne $month ]
   then
  
  ## 지난달 nmon 파일 묶어
      tar -cf $LASTMONTH.tar `ls *"_"$lastmonth*"_"*`    

   ## 1월엔 작년 12월로 묶기
   else
      tar -cf $LASTYEAR"12".tar `ls *"_"$lastyear"12"`

   fi

   gzip *.tar

  ## 만약 압축파일 생성 안되면 파일 삭제 안함
   if [ -f $LASTMONTH.tar.gz ]
   then
      rm -f `ls *"_"$lastmonth*"_"*`
   fi

  ## 6개월 지난 파일 삭제
   find $datidir -name "*.gz" -mtime +180 -exec rm -f {} \;

fi

###### nmon 실행 ######
cd $bindir

## nmon 실행중이면 중지
if [ 0 -ne `ps -ef|grep nmon|grep -v grep|wc -l` ]
then

   ps -ef|grep nmon|grep -v grep|grep -v nmon.sh|awk '{print "kill -9 "$2}'|sh -v
fi
sleep 1

## 60초 마다 한번씩 1440번(하루)
$bindir/nmon -ft -s 60 -c 1440

'Shell script' 카테고리의 다른 글

TSM 실행 결과 저장  (0) 2010.10.20
[Win] True image cmd script  (0) 2010.04.14
odm 저장 스크립트  (0) 2009.10.21
if 표현식  (0) 2009.10.16
erp check shell-070215  (0) 2007.03.16
Posted by efrit
,