I have a made a script to move a logs from my source server to a target server.
Code:
#! /usr/bin/ksh
year=`date +%y`
month=`date +%m`
day=`date +%d`
direc=`date +%d%m%y`
echo "backup_script_started `date`" > /BKUP/complete_$direc.txt
cd /BKUP/`date +%d%m%y`
/usr/bin/gzip /BKUP/`date +%d%m%y`/*.*
ftp -v -n 172.12.12.14 <<INPUT
user root root_123 1
bin
prompt
cd /log1/Backups
mkdir $direc
cd /log1/Backups/$direc/
mkdir log_$direc
cd /log1/Backups/$direc/log_$direc
mput *.gz
quit
INPUT
echo "backup_script_ended at `date`" >> /BKUP/complete_$direc.txt
In this script i am facing some issue , the ftp is happening successfully but i am not able to get the directory created with the date. mkdir command is not getting executed successfully , whereas if i login manually the mkdir command is working.
This script is failing some where and couldn't crack it.
Need advice
Last edited by Scott; 07-18-2014 at 03:16 AM..
Reason: Code tags