Sh3ll
OdayForums


Server : Apache
System : Linux profile 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64
User : apache ( 48)
PHP Version : 8.0.28
Disable Function : NONE
Directory :  /Data/.backup/script/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //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

ZeroDay Forums Mini