Tech_Info/SAP2007. 3. 5. 11:16

#!/usr/bin/ksh
##############################################
# Subject : Automate script for system admin
#           gether nmon data monthly
# Create by : Guri / hyosuk@gmail.com
# Create date : 2006-12-22
# Modified by : Guri
# Modified date :
# Modified Contents :
#
# Scheduled Execute Date : Everymonth 1st
##############################################
PATH=/usr/bin:.
HOSTNAME=`hostname`

##################
# Previous Month #
##################
YEAR=`date +%y`
MONTH=`date +%m`

if [ $MONTH -eq 01 ]
then
    YEAR=`expr $YEAR - 1`;
    MONTH=12;
else
    MONTH=`expr $MONTH - 1`;
fi


if ((${#MONTH} < 2)) ;then
 MONTH=0$MONTH
fi

if ((${#YEAR} < 2)) ;then
 YEAR=0$YEAR
fi

TODAY=$YEAR$MONTH;

## nmon file directory
NMONDIR=/work/nmon

## target nmon file name
NMONFILE=$HOSTNAME\_$TODAY*.nmon

## move to nmon directory
cd $NMONDIR

########################################
# Send this file to NIM Server by FTP  #
########################################
HOST=10.44.155.202
USER=xxxxxxx
PASSWORD=xxxxxxxx

ftp -i -n << HERE
open $HOST
user $USER $PASSWORD
cd nmon
cd $HOSTNAME
mkdir $TODAY
cd $TODAY
mput $NMONFILE
close
bye
HERE
#

매월마다 Nmon data 옮겨놓기 귀찮아서 스크립트를 짰다.
별거없다. 지난달 날짜 구해서, FTP에 mput으로 보내는 내용임.
스크립트는 게으른 사람이 짠다더니 맞나부다. ㅎㅎ
Posted by 알 수 없는 사용자