In: Computer Science
Examine the following shell script and describe its function line-by-line:
#! /bin/bash
#This script backs up the Oracle DB
rm -f /SAN/backup-oracle*
if tar -zcvf /SAN/backup-oracle- 'date +%F'.tar.gz/oracledb/*
then
echo "Oracle backup completed on 'date'" >>/var/log/oraclelog
else
echo "Oracle backup failed on 'date'" >>/var/log/oraclelog
mail -s ALERT [email protected] </var/log/oraclelog
fi
#! /bin/bash
#This script backs up the Oracle DB
rm -f /SAN/backup-oracle*
if tar -zcvf /SAN/backup-oracle- 'date +%F'.tar.gz/oracledb/*
then
echo "Oracle backup completed on 'date'" >>/var/log/oraclelog
else
echo "Oracle backup failed on 'date'" >>/var/log/oraclelog
mail -s ALERT [email protected] </var/log/oraclelog
fi
#! /bin/bash
#This script backs up the Oracle DB
rm -f /SAN/backup-oracle*
This will remove the files with name starting with 'backup-oracle' forcefully in the /SAN/ folder
if tar -zcvf /SAN/backup-oracle- 'date +%F'.tar.gz/oracledb/*
echo "Oracle backup completed on 'date'" >>/var/log/oraclelog
else
echo "Oracle backup failed on 'date'" >>/var/log/oraclelog
mail -s ALERT [email protected] </var/log/oraclelog
<
is used to redirect input to
oraclelog file in the /var/log/ directoryfi will end the if statement
If you have any doubts, leave a comment below before rating. I'll be happy to assist you further.
Do UPVOTE this as I have put a lot of EFFORT in answering this question. It really helps me.