#!/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 From: http://sitestree.com/?p=12199
Categories:Linux/Unix: Shell Programming – 001
Tags:
Post Data:2018-04-16 19:44:31
Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada