From 35908ff8dcbd437b6b5c773b2cdb72d368744d34 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 20 Dec 2014 19:12:29 +0000 Subject: [PATCH] Use sshpass for remote backups --- install-freedombone.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/install-freedombone.sh b/install-freedombone.sh index bca1f970..54bdc9cd 100755 --- a/install-freedombone.sh +++ b/install-freedombone.sh @@ -1593,7 +1593,7 @@ function backup_to_friends_servers { return fi - apt-get -y --force-yes install rsyncrypto + apt-get -y --force-yes install rsyncrypto sshpass get_mariadb_password get_mariadb_gnusocial_admin_password @@ -2146,7 +2146,7 @@ function backup_to_friends_servers { echo -n "awk -F ' ' '{print " >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo -n '$2' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo "}')" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo -n ' export RSYNC_PASSWORD=$(echo "${remote_server}" | ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo -n ' REMOTE_PASSWORD=$(echo "${remote_server}" | ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo -n "awk -F ' ' '{print " >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo -n '$3' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo "}')" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -2154,7 +2154,8 @@ function backup_to_friends_servers { echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' echo "$NOW Starting backup to $REMOTE_SERVER" >> /var/log/backup_to_friends.log' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo -n ' rsync -avz -e "ssh -p $REMOTE_SSH_PORT" ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + + echo -n ' rsync -ratlz --rsh="/usr/bin/sshpass -p $REMOTE_PASSWORD ssh -p $REMOTE_SSH_PORT -o StrictHostKeyChecking=no" ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '$SERVER_DIRECTORY/backup $REMOTE_SERVER' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' echo "$NOW Backup to $REMOTE_SERVER failed" >> /var/log/backup_to_friends.log' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -2171,9 +2172,6 @@ function backup_to_friends_servers { echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo "done < $FRIENDS_SERVERS_LIST" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo '# Clear the rsync password' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'export RSYNC_PASSWORD=""' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'exit 0' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME chown root:root /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME chmod 400 /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -2192,7 +2190,7 @@ function restore_from_friend { return fi - apt-get -y --force-yes install rsyncrypto + apt-get -y --force-yes install rsyncrypto sshpass get_mariadb_password get_mariadb_gnusocial_admin_password