Could someone please explain how can i loop the below logic, This logic needs to run for every week. For eg : In 1st week in source folder i have a files and folder called stack.txt, webmethods, profiles so when i ran the logic all these files are taken backup to the destination folder. In 2nd week in source folder extra directory added i.e. Kafka so now when the logic runs it should not take backup completely only the newly added things ..like Incremental backup
#!/bin/bash
# What to backup.
Integrationserver="/home/ec2-user/source"
# Where to backup to.
dest="/home/ec2-user/destination"
# Create archive filename.
#date=$(date +%F)
IS=source
hostname=$(hostname -s)
#archive_file="$hostname-$IS-$date.tar.gz"
archive_file="$hostname-$IS.tar.gz"
# Print start status message.
echo "Backing up $Integrationserver to $dest/$archive_file"
date
echo
# Backup the files using tar.
tar --exclude=/home/ec2-user/source/logs* --exclude=/home/ec2-user/source/TC* -zcf $dest/$archive_file $Integrationserver
# Print end status message.
echo
echo "Backup finished"
date