I have a very strange problem. I have two servers, namely
daytona, which serves as a storage server with a raid array. I WOL it when I want to back up to it. The second server is
testarossa which runs my services. It is the latter that I want to backup daily using duplicity. Both machines run Ubuntu Server 14.04, fully up-to-date.
I have written a script to WOL the machine and then execute the duplicity backup each day on a fixed time.
The import part of the backupscript is shown below. The backup runs as user
testarossa and backups over SSH via
daytona. Then it shuts down via
ssh using user
I have configured ssh keys on
testarossa so I can ssh into
christophe. I can execute the commands from the script just fine, and even execute the script in the shell as well (
I have added the script in the cronjobs using:
0 10 * * * /bin/bash /root/scripts/dailybackup >> /var/log/backup.daily.log 2>&1
Each time the cronjob runs I get the following error:
BackendException: ssh connection to firstname.lastname@example.org:22 failed: [Errno 111] Connection refused
I have, suggested on
echo "" | nc 192.168.1.120 22 and that returns the following error:
SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3 Protocol mismatch.
This led me to believe that I had to upgrade
daytona which I did. There was an upgrade for the
gnu-openssl package and then the cronjob ran fine. But now it doesn't anymore.
I am out of ideas on how to debug this. I have too little experience to fix it. Any pointers?
serverip=192.168.1.120 servermac=14:DA:E9:4C:6E:17 attempts=50 sourcedir="/" targetdir="sftp://email@example.com//mnt/raidarr0/backups/testarossa/duplicity/daily" encryptkey="AC7A8F8C" keep="1M" sudouser="christophe" fullbackup="" ## Load in the passphrase file env variable . /root/.passphrase export PASSPHRASE ## Do the snapshot backup if [ "$fullbackup" == "full" ]; then $(which duplicity) full --encrypt-key "$encryptkey" --exclude /srv --exclude /usr --exclude /cdrom --exclude /lib64 --exclude /bin --exclude /sbin --exclude /boot --exclude /dev --exclude /proc --exclude /sys --exclude /tmp --exclude /run --exclude /mnt --exclude /media --exclude /lost+found "$sourcedir" "$targetdir" else $(which duplicity) --encrypt-key "$encryptkey" --exclude /srv --exclude /usr --exclude /cdrom --exclude /lib64 --exclude /bin --exclude /sbin --exclude /boot --exclude /dev --exclude /proc --exclude /sys --exclude /tmp --exclude /run --exclude /mnt --exclude /media --exclude /lost+found "$sourcedir" "$targetdir" fi echo "Backup to target completed." ## Remove older backups. We only want to backup 30 days. # (We have a full every month) $(which duplicity) remove-older-than "$keep" --force "$targetdir" echo "Removal of stale backups completed" ## Shut down the machine using a sudo account. Expects the user to have a key installed for this. ssh "$sudouser"@"$serverip" "sudo shutdown -h now" echo "Shutdown command issued to remote machine"
1) The script has a function which waits for the host to be ping-able. So it only starts backing up when the host has fully booted. (This script ran fine for over a year on a different machine with Debian.)
2) The script runs fine in the shell of the root indeed.
3) And no, I do not have a proxy command in either setting files.
4) I have tried running the command using
sudo /bin/bash /root/scripts/dailybackup and now, for some reason, it asks me to verify the authenticity of the host (with
yes/no). So now it seems like the duplicity command is not using my