#!/bin/ksh
# on every thursday and friday tar all contents of /etc folder into /export/home/shell/test/. On thursday only create a log file with the list of files
#in the tar file. On thursday untar /export/home/shell/test/etc.tar into vfstab . Then log vfstab exist or not information
DAY=`date +%a`
DATESTAMP=`date +%m-%d-%Y-%H:%M`
if [[ “$DAY” == Mon ]]
then
echo “Today is Monday”
elif [[ “$DAY” == Tue ]]
then
echo “Today is Tuesday”
elif [[ “$DAY” == Wed ]]
then
echo “Today is Wednesday”
elif [[ “$DAY” == Thu ]]
then
echo “Today is Thursday” >> /export/home/shell/test/log/backup-$DATESTAMP.log
cd /etc
tar cvf /export/home/shell/test/etc.tar * >> /export/home/shell/test/log/backup-$DATESTAMP.log
cd /export/home/shell/test
tar xvf etc.tar vfstab
if [[ -f vfstab ]]
then
echo “file vfstab exist” >> /export/home/shell/test/log/backup-$DATESTAMP.log
else
echo “file vfstab does not exist” >> /export/home/shell/test/log/backup-$DATESTAMP.log
fi
elif [[ “$DAY” == Fri ]]
then
echo “Today is Friday”
cd /etc
tar cvf /export/home/shell/test/etc.tar *
elif [[ “$DAY” == Sat ]]
then
echo “Today is Saturday”
else
echo “Today is Sunday”
fi
exit