So I have a script that runs an ls on a given directory and looks for files with a timestamp that has the current hour in it and then does work with the files that it discovers
Code:
DATE=`date +’%y%m%d%H’`
HOSTIS=`hostname`
#EMAIL NOTIFICATION ALS
EMAIL=address@server.com
#
if [ $HOSTIS = ‘serverhostname’ ]; then
TOHOST=’destination_address@destination_server.com’
else
#This is for the test server
TOHOST=’test_address@test_server.com’
fi
for i in `ls /transfer |grep $DATE`
do
sftp -vvv $TOHOST 2>&1 | tee /homedir/user/debug.out
Source: The UNIX and Linux Forums
