Ошибки rdiff-backup: скрипт продолжает выходить с ошибкой

Недавно меня познакомили с bash-скриптингом... Итак, я использовал свой продвинутый курс кражи, чтобы собрать воедино прилагаемый скрипт. он запускается... и завершается с "/xxx/ не смонтирован. Вы не root! У меня установлены и работают rdiff-backup и sshfs. Команды работают нормально в командной строке, но в сценарии, ну.. Не могли бы вы, ребята, взглянуть и позвольте мне знать? PS Я скопировал МНОГО этого из сценариев, которые я нашел здесь и в нескольких других местах.

<code>
#!/bin/bash
# Version 1.5
# Prior to running this make sure you have ssh-keygen -t rsa to generate a key, then
# ssh username@target "mkdir .ssh/;chmod 700 .ssh"
# scp .ssh/id_rsa.pub username@target:.ssh/authorized_keys
#
# then check you can login and accept the ssh key
# ssh username@target "ls -la"
#
# Key things to remember, no spaces in pathnames, and try to use full paths (beginning with / )
#
# variables determine backup criteria

DATESTAMP=`date +%d%m%y`
USERNAME=username #remote site username here
TARGET=remote.ip.here #add the ip v4 address of the target
INCLUDES=/path/to/file/includes.txt #this is a txt file containing a list of directories you want backed up
EXCLUDES="**" #this is a list of files etc you want to skip
BACKUPLOG=/path/to/logfile/in/home/backuplog${DATESTAMP}.txt
OLDERTHAN=20W #change 20 to reflect how far back you want backups to exist
# to activate old backup expiry, uncomment the line below
#RMARGS=" --force --remove-older-than ${OLDERTHAN}"
TARGETMAIL="yourmailaddress@your.domain"

HOSTNAME=`hostname` #Dont change this!
TMPDIR=/backups Change this to the source folder
TARGETFOLDER=/backups change this to the TARGET folder

ARGS=" -v0 --terminal-verbosity 0 --exclude-special-files --exclude-other-filesystems --no-compression -v6"

# detecting distro and setting the correct path
if [ -e /etc/debian_version ];then
    NICE=/usr/bin/nice
elif [ -e /etc/redhat-release ];then
    NICE=/bin/nice
fi


if [ -e /tmp/backup.lock ];then
    exit 0
fi
touch /tmp/backup.lock
touch -a ${BACKUPLOG}

cd /
/bin/mkdir -p ${TMPDIR}

/usr/bin/sshfs -o idmap=user -o ${USERNAME}@${TARGET}:/${TARGETFOLDER} ${TMPDIR} &>${BACKUPLOG}
# if you get errors mounting this then try 
# mknod /dev/fuse -m 0666 c 10 229

for ITEMI in ${INCLUDES} ; do
                    ARGS="${ARGS} --include ${ITEMI} "
done
for ITEME in ${EXCLUDES} ; do
                    ARGS="${ARGS} --exclude-regexp '${ITEME}' "
done
# the --exclude ** / is a hack because it wont by default do multiple dirs, so use --include for all dirs then exclude everything else and sync / - if you dont understand dont worry 
# ref: http://www.mail-archive.com/rdiff-backup-users@nongnu.org/msg00311.html
#echo /usr/bin/rdiff-backup ${ARGS} --exclude \'**\' / ${TMPDIR}/ &&

cat ${INCLUDES} | while read DIR; do
            ${NICE} -19 /usr/bin/rdiff-backup --exclude '**' ${DIR} ${TMPDIR}/ &>${BACKUPLOG}
            if [ $? != 0 ]; then
                    echo "System Backup Failed" | mutt -s "Backup Log: System Backup Failed, Log attached!" -a ${BACKUPLOG} ${TARGETMAIL}
                    exit 1;
            fi
    done


#${NICE} -19 /usr/bin/rdiff-backup ${ARGS} --exclude '**' / ${TMPDIR}/ &>${BACKUPLOG} &&
echo Removing backups older than ${RMARGS}
${NICE} -19 /usr/bin/rdiff-backup -v0 --terminal-verbosity 0  ${RMARGS} ${TMPDIR}/ &>${BACKUPLOG}
/bin/umount ${TMPDIR} && /bin/rm -rf ${TMPDIR}/ &>${BACKUPLOG}
echo "System Backup Run" | mutt -s "Backup Log: System Backup Done!" -a ${BACKUPLOG} ${TARGETMAIL}

rm /tmp/backup.lock
rm ${BACKUPLOG}

Извините, не могу вставить, не могу прикрепить... BLIKSEM!

Спасибо за ЛЮБОЙ ввод... Один АД кривой обучения!!! С уважением, Б.

0 ответов

Другие вопросы по тегам