Any suggestions, please?
This whole backup issue is bugging me for days and I can't get it working :'(
I want to use a script to do an automated backup of another machine using rsync.
Part of the problems I have is that if I try to rund the script it won't run:
cannot execute binary file
Ownership and permissions are set correctly
The User that should execute it has rx (500) on it. But neither he nor root can run it.
Here is the script:
Code:
#!/bin/bash
#
# Script zieht per rsync Backups
# http://www.heinlein-partner.de
#
# Aufruf: backup-rsync <fqdn-servername>
#
# ### Aufrufparameter des Scripts ist ein FQDN-Hostname
if [ -n "$1" ] ; then
SERVER="$1"
else
echo "Error: Usage $0 <fqdn-hostname>"
exit
fi
# ### Konfiguration
# Sollen wir pruefen, ob noch ein gewisser Prozentsatz
# an Plattenplatz und Inodes frei ist?
CHECK_HDMINFREE=true
HDMINFREE=90
# Soll die Daten-Partition readonly gemountet werden,
# wenn wir sie nicht mehr brauchen?
MOUNT_RO=false
MOUNT_DEVICE=/dev/hda7
# Unter welchem Pfad wird gesichert?
DATA_PATH=/DATA
# Liste von Dateipattern, die nicht gebackupt werden sollen
EXCLUDES=/etc/rsync-excludelist
# Weitere Optionen für rsync. Ggf. macht eine Limitierung
# der Bandbreite Sinn, Angabe in kbyte/sec:
# EXTRAOPT="--bwlimit=256"
EXTRAOPT=""
# ### Let´s Rock`n`Roll
# Pruefe auf freien Plattenplatz
GETPERCENTAGE='s/.* \([0-9]\{1,3\}\)%.*/\1/'
if $CHECK_HDMINFREE ; then
KBISFREE=`df /$DATA_PATH | tail -n1 | sed -e "$GETPERCENTAGE"`
INODEISFREE=`df -i /$DATA_PATH | tail -n1 | sed -e "$GETPERCENTAGE"`
if [ $KBISFREE -ge $HDMINFREE -o $INODEISFREE -ge $HDMINFREE ] ; then
echo "Fatal: Not enough space left for rsyncing backups!"
logger "Fatal: Not enough space left for rsyncing backups!"
exit
fi
fi
# Festplatte rw remounten falls gewünscht!
if $MOUNT_RO ; then
if `mount -o remount,rw $MOUNT_DEVICE $DATA_PATH` ; then
echo "Error: Could not remount $MOUNT_DEV readwrite"
logger "Error: Could not remount $MOUNT_DEV readwrite"
exit
fi
fi
# Ggf. Verzeichnis anlegen
if ! [ -d $DATA_PATH/$SERVER/daily.0 ] ; then
mkdir -p $DATA_PATH/$SERVER/daily.0
fi
# Los geht`s: rsync zieht ein Vollbackup
echo "Starting rsync backup from $SERVER..."
logger "Starting rsync backup from $SERVER..."
rsync -avz --numeric-ids -e ssh --delete --delete-excluded \
--exclude-from="$EXCLUDES" $EXTRAOPT \
$SERVER:/ $DATA_PATH/$SERVER/daily.0
# Rückgabewert prüfen.
# 0 = fehlerfrei,
# 24 ist harmlos; tritt auf, wenn während der Laufzeit
# von rsync noch (/tmp?) Dateien verändert oder gelöscht wurden.
# Alles andere ist fatal -- siehe man (1) rsync
if ! [ $? = 24 -o $? = 0 ] ; then
echo "Fatal: rsync finished $SERVER with errors!"
logger "Fatal: rsync finished $SERVER with errors!"
fi
# Verzeichnis anfassen, um Backup-Datum zu speichern
touch $DATA_PATH/$SERVER/daily.0
# Fertig!
echo "Finished rsync backup from $SERVER..."
logger "Finished rsync backup from $SERVER..."
# Sicher ist sicher...
sync
# Festplatte ro remounten falls gewünscht!
if $MOUNT_RO ; then
if `mount -o remount,ro $MOUNT_DEVICE $DATA_PATH` ; then
echo "Error: Could not remount $MOUNT_DEV readonly"
logger "Error: Could not remount $MOUNT_DEV readonly"
exit
fi
fi
I tried it w/o success on a Suse 9.3 distrib (i586 OS on Opteron CPU) and Suse 10.0 (i586 OS on Athlon CPU).
What is the Prob here?
btw I am neither a newbee nor a linux pro, so please, if you suggest to take a certain action also mention how