К основному контенту

Сообщения

Сообщения за Июль, 2007

Проба пера - скрипт на BASH'е

#!/bin/sh
##############################################
# (c), 2007, Shulepov #
##############################################

##### Setting configuration #############

localdir=/root/zov/localdir
utlfiledir=/u05/oradata/utlfile
ftphost=somehost.com
ftpuser=john
ftppass=doe
ftpdir=data
uploadfile=file_`date "+%d%m%Y"`.zip
xmlfile=file_`date "+%d%m%Y"`.xml
MAILTO=some@mail.ru

echo "Moving file into work directory"
mv $utlfiledir/$xmlfile $localdir

##### Packing file ###############
cd $localdir
zip -D $uploadfile $xmlfile

##### Upload to ftp-server ##############
echo "Uploading file using ftp..."
ftp -in $ftphost<<_EOF_
user $ftpuser $ftppass
cd $ftpdir
bin
put $uploadfile
ls -a out.txt
quit
_EOF_

rfsize=0
lfsize=`ls -al|grep $uploadfile|gawk '{print $5}'`
rfsize=`cat out.txt|grep $uploadfile|gawk '{print $5}'`

# Compare filesize of local and remote uploaded file #

if [ $lfsize -eq $rfsize ]
then # local file size eq…

vi / vim подсказка