コード

#!/bin/sh
# ------------------------
#  backup script
# ------------------------
# Version : 1.0
# date    : 2007/03/13

export LANG=C
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:$PATH

## Set

FTPSRV="ServerIP or ServerName"
FTPUSER="FTP USER"
FTPPASSWD="FTP PASSWORD"
BACUPDIR="/home/system/backup/"
BACUPFILE="*tgz"

TEMP="/home/system/script/ftp.txt"
LOGDIR="/home/system/logs"

DATE=`date +%Y%m`
LOGFILE="upload.log"
LOG=$LOGDIR/$LOGFILE

## Exec

# Log Header
LOGDATE=`date +%Y/%m/%d`
STARTTIME=`date +%Y/%m/%d\ %H:%M:%S`
cat <<EOF >> $LOG
---------------------------
 Upload Start
---------------------------
EOF

## --------------
## Create FTP.txt
## --------------
cat <<EOF > $TEMP
open $FTPSRV
user $FTPUSER $FTPPASSWD
bin
cd $BACUPDIR

EOF

cd $BACUPDIR
ls -l $BACUPFILE | awk '{printf "%s\n",$9}' | sed "/^$/d" | awk '{printf "put %s\n",$1}' >> $TEMP

echo quit >> $TEMP

# FTP Exec
/usr/bin/ftp -n < $TEMP 2>&1 >> $LOG
rm -f $TEMP


# Log Footer
ENDTIME=`date +%Y/%m/%d\ %H:%M:%S`
cat <<EOF >> $LOG
---------------------------
 Upload End 
---------------------------
StartTime : $STARTTIME
EndTime   : $ENDTIME
---------------------------
EOF


# EOF

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2007-05-07 (月) 18:28:26 (6142d)