Your IP : 216.73.216.40


Current Path : /proc/self/root/Data/.backup/script/
Upload File :
Current File : //proc/self/root/Data/.backup/script/rsnapshotbackup.sh

#!/bin/bash
# Check if backup type is provided
if [ -z "$1" ]; then
echo "Usage: $0 <backup_type>"
exit 1
fi

BACKUP_TYPE=$1
LOCK_FILE="/var/run/rsnapshot.pid"

# Function to perform the backup
perform_backup() {
	/usr/bin/rsnapshot "$BACKUP_TYPE"
		if [ "$BACKUP_TYPE" == "hourago" ]; then
			sleep 300 && /Data/.backup/script/mydbdump.sh
				fi
}

# Check if LOCK_FILE exists
while [ -e "$LOCK_FILE" ]; do
echo "One Backup is already in progress. Retrying in 5 minutes..."
sleep 300  # Wait for 5 minutes before retrying
done

# Attempt the backup
OUTPUT=$(perform_backup)

	if [ -n "$OUTPUT" ]; then
	echo "$OUTPUT" | /usr/bin/rsnapreport.pl | mutt -s "Error in ${BACKUP_TYPE} backup for profile.iiita.ac.in dated-$(date +%F)" -- to.nm@iiita.ac.in
	fi