Following script will be put into exportarchive.sh files and added to the cronjob in linux server to run and export archive file everyday for backup.
exportarchive.sh
================================================
#!/bin/bash
folderName= `date +%Y%m%d`
export SCRIPT_PATH=/obiee12c/scripts
export DOMAIN_PATH=/obiee12c/user_projects/domains/bi/bitools/bin
export EXPORT_DIR=/obishare/barbackup/migration
MAIL_TO=bose.obiee@gmail.com,xyz@gmail.com,abc@gmail.com
#MAIL_TO=bose.obiee@gmail.com,xyz@gmail.com,abc@gmail.com
mkdir -p $EXPORT_DIR/$folderName
echo "Running the export archive script"
echo "Exporting............................."
$DOMAIN_PATH/exportarchive.sh ssi $EXPORT_DIR/$folderName encryptionpassword=admin123 >> $EXPORT_DIR/$folderName/export.log
SUCCESS_COUNT=`grep "Export archive completed successfully" $EXPORT_DIR/$folderName/export.log | wc -l`
if [ "${SUCCESS_COUNT}" -eq "l" ]
then
echo -e "Hi Team, \nThe export of BAR in `hostname` is completed and the export is available in ${EXPORT_DIR} \n\nThanks" | mail -s "BAR export is completed successfully in `hostname`" ${MAIL_TO}
else
echo -e "Hi Team, \nThe export of BAR in `hostname` is not completed and the export log is available in ${EXPORT_DIR} \n\nThanks" | mail -s "BAR export has failed in `hostname`" ${MAIL_TO} -a $EXPORT_DIR/$folderName/export.log ${MAIL_TO}
exit
fi
#Cleaning BAR files which are older than 7 days
find ${EXPORT_DIR} -name "20*" -type d -mtime +7 -exec rm rf {} \;
==========================================
No comments:
Post a Comment