I am working on a backup script (bash shell - Fedora - VMware) that should compare a file with last modified attribute and current date and should back it up if the last modified date is older than the last run of the script.
I have tried couple of things (awk,stat and grep) however i could not make something which enables the comparison and lets the script decide if the files should be backed up or not.
Please focus on 2 case statement.
#! /bin/sh
echo "welcome to backup pro"
echo -e "\n 1:Full \n 2:Incremental"
echo "Enter your choice"
read choice
echo "Enter the files to be backup"
read filetype
echo "Enter the destination folder"
read destination
case $choice in
1)
echo "The selected backup type is Full backup"
echo "Backing up $filetype files.."
sleep 1
cp *.$filetype /home/uone/backup_folder
tar -zcvf archive_backup_folder.tar.gz backup_folder/ 2>full-error.log
mv archive_backup_folder.tar.gz /home/uone/backup_folder; cd /home/uone/backup_folder ; rm *.$filetype
sleep 1
tail full-error.log
break
;;
2)
echo "The backup you chose is Increment"
ls -l | awk 'END {print $9 "\t" $8}'
b=data "%H%M%S"
if [ $a -lt $b ];
then
echo "This is under construction"
fi
;;
esac
exit 0
$destination
.