LOG_FILE_DIR="/home/mike/"
LOCAL_LOG_FILE=$LOG_FILE_DIR/"server_`date +%m%d%Y`.log"
SENDMAIL=0
MAIL_FILE=tmp.txt
REMOTE_DIR="/home/john"
for dir in /home/mike; do
if [ -d ${dir}/"test" ]; then
/usr/local/bin/ssh -l melo ferrari "mkdir -m 777 $REMOTE_DIR/$dir" >>$LOCAL_LOG_FILE 2>&1
if [ $? != 0 ]; then
SENDMAIL=1
echo "Cannot create directory $dir " >> MAIL_FILE
fi
scp -r ${dir}/"test" ferrari:$REMOTE_DIR/${dir}/
if [ $? != 0 ]; then
SENDMAIL=1
echo "Cannot create directory $dir " >> MAIL_FILE
fi
/usr/local/bin/ssh -l melo ferrari "chmod -R 777 $REMOTE_DIR/$dir"
if [ $? != 0 ]; then
SENDMAIL=1
echo "Cannot change the chmod for $dir " >> MAIL_FILE
fi
fi
done
mail -s "[email protected]" < MAIL_FILE
exit 0
|