EnderUNIX Team.


EnderUNIX tips

Mail to My Friend , Home Page

[ Shell Scripting ]

"Tar, Zip and FTP of a given list of files" - Mehmet Uluer - (2007-01-12 09:28:10)   [8205]

oracle@muluer:/u06/oracle/archive> more tarzipftp.sh
################################################
#
# Script for moving Oracle archive files
# Jan 12, v.0.1, Mehmet Uluer
# Usage: ./tarzipftp.sh file_list
# file_list : list of *.arc file names
#
################################################

#!/bin/bash

file_list=$1
touch ${file_list}.log
echo \\\"------started-----\\\" >> ${file_list}.log
echo `date +%y%m%d_%H%M` >> ${file_list}.log
echo \\\"making ${file_list}.tar ...\\\" >> ${file_list}.log
tar -cvf ${file_list}.tar -T $file_list >> ${file_list}.log
echo `date +%y%m%d_%H%M` >> ${file_list}.log
echo \\\"zipping to ${file_list}.tar.bz2 ...\\\" >> ${file_list}.log
bzip2 ${file_list}.tar
echo `date +%y%m%d_%H%M` >> ${file_list}.log
echo \\\"ftp ${file_list}.tar.bz2 to 99.99.99.99 ...\\\" >> ${file_list}.log
ftp -i -v -n 99.99.99.99 >> ${file_list}.log <<-FTP_END
user oracle mySecretPasswd
cd /u02/arch
put ${file_list}.tar.bz2
bye
FTP_END
echo `date +%y%m%d_%H%M` >> ${file_list}.log
echo \\\"cleaning ${file_list}.tar.bz2 ...\\\" >> ${file_list}.log
rm -rf ${file_list}.tar.bz2
echo `date +%y%m%d_%H%M` >> ${file_list}.log
echo \\\"------finished-----\\\" >> ${file_list}.log
oracle@muluer:/u06/oracle/archive>

Mail to My Friend , Home Page