i have written a script to sftp yesterday's logs from another server as below:
cd /export/home/abc/xyz/tt
d=`gdate -d'yesterday' +%Y%m%d`
sftp abc@XXX.XX.XX.XX<<EOF
cd /yyy/logs/archive
mget abc.log.$d*
EOF
cd /export/home/abc/xyz/scripts
nohup ./ss.sh PROD &
it is working fine when ran as:
sh ./scriptname.sh
but when i cronned it , it is pulling logs from the starting date of logs that the folder contains.
ex; today is 15th April 2014 , so the script should pull 14th April 2014 logs
It is working fine when i ran it as sh ./scriptname.sh
but when i cronned it , it is pulling log files which has starting date of 1st january 2014 which is the minimum date that the folder contains
is there any changes need to be done for the script to cron it..