Separate remote backips file with spaces

This commit is contained in:
Bob Mottram 2015-12-22 21:36:43 +00:00
parent 6077da4ac6
commit 46e0aba9b3
3 changed files with 11 additions and 7 deletions

View File

@ -533,13 +533,15 @@ while read remote_server
do do
# Get the server and its password # Get the server and its password
# Format is: # Format is:
# username@domain:/home/username <port number> <ssh password> # username@domain <port number> /home/username <ssh password>
REMOTE_SERVER=$(echo "${remote_server}" | awk -F ' ' '{print $1}') REMOTE_SERVER=$(echo "${remote_server}" | awk -F ' ' '{print $1}')
if [ $REMOTE_SERVER ]; then if [ $REMOTE_SERVER ]; then
REMOTE_DOMAIN=$(echo "${remote_server}" | awk -F ':' '{print $1}' | awk -F '@' '{print $2}') REMOTE_DOMAIN=$(echo "${remote_server}" | awk -F ' ' '{print $1}' | awk -F '@' '{print $2}')
REMOTE_SSH_PORT=$(echo "${remote_server}" | awk -F ' ' '{print $2}') REMOTE_SSH_PORT=$(echo "${remote_server}" | awk -F ' ' '{print $2}')
REMOTE_PASSWORD=$(echo "${remote_server}" | awk -F ' ' '{print $3}') REMOTE_DIRECTORY=$(echo "${remote_server}" | awk -F ' ' '{print $3}')
REMOTE_PASSWORD=$(echo "${remote_server}" | awk -F ' ' '{print $4}')
NOW=$(date +"%Y-%m-%d %H:%M:%S") NOW=$(date +"%Y-%m-%d %H:%M:%S")
REMOTE_SERVER=$REMOTE_SERVER:$REMOTE_DIRECTORY
echo "$NOW Starting backup to $REMOTE_SERVER" >> /var/log/remotebackups.log echo "$NOW Starting backup to $REMOTE_SERVER" >> /var/log/remotebackups.log

View File

@ -196,7 +196,7 @@ function interactive_configuration_remote_backups {
dialog --title "Password quality check" --msgbox "The reciprocal password given was too short. It must be at least $MINIMUM_PASSWORD_LENGTH characters" 6 40 dialog --title "Password quality check" --msgbox "The reciprocal password given was too short. It must be at least $MINIMUM_PASSWORD_LENGTH characters" 6 40
else else
echo ${remote_ssh_reciprocal_username}:${remote_ssh_reciprocal_password}::::/home/${remote_ssh_reciprocal_username}:bash | newusers echo ${remote_ssh_reciprocal_username}:${remote_ssh_reciprocal_password}::::/home/${remote_ssh_reciprocal_username}:bash | newusers
echo "$remote_ssh_username@$remote_ssh_domain:$remote_ssh_port//home/$remote_ssh_username $remote_ssh_password" >> $FRIENDS_SERVERS_LIST echo "$remote_ssh_username@$remote_ssh_domain $remote_ssh_port /home/$remote_ssh_username $remote_ssh_password" >> $FRIENDS_SERVERS_LIST
remote_ssh_username="" remote_ssh_username=""
remote_ssh_domain="" remote_ssh_domain=""
remote_ssh_port="" remote_ssh_port=""
@ -206,7 +206,7 @@ function interactive_configuration_remote_backups {
entering_remote_backups_ctr=$((entering_remote_backups_ctr + 1)) entering_remote_backups_ctr=$((entering_remote_backups_ctr + 1))
fi fi
else else
echo "$remote_ssh_username@$remote_ssh_domain:$remote_ssh_port//home/$remote_ssh_username $remote_ssh_password" >> $FRIENDS_SERVERS_LIST echo "$remote_ssh_username@$remote_ssh_domain $remote_ssh_port /home/$remote_ssh_username $remote_ssh_password" >> $FRIENDS_SERVERS_LIST
remote_ssh_username="" remote_ssh_username=""
remote_ssh_domain="" remote_ssh_domain=""
remote_ssh_port="" remote_ssh_port=""
@ -216,7 +216,7 @@ function interactive_configuration_remote_backups {
entering_remote_backups_ctr=$((entering_remote_backups_ctr + 1)) entering_remote_backups_ctr=$((entering_remote_backups_ctr + 1))
fi fi
else else
echo "$remote_ssh_username@$remote_ssh_domain:$remote_ssh_port//home/$remote_ssh_username $remote_ssh_password" >> $FRIENDS_SERVERS_LIST echo "$remote_ssh_username@$remote_ssh_domain $remote_ssh_port /home/$remote_ssh_username $remote_ssh_password" >> $FRIENDS_SERVERS_LIST
remote_ssh_username="" remote_ssh_username=""
remote_ssh_domain="" remote_ssh_domain=""
remote_ssh_port="" remote_ssh_port=""

View File

@ -70,7 +70,9 @@ fi
REMOTE_SERVER=$(grep -i "$SERVER_NAME" $BACKUP_LIST | awk -F ' ' '{print $1}') REMOTE_SERVER=$(grep -i "$SERVER_NAME" $BACKUP_LIST | awk -F ' ' '{print $1}')
REMOTE_SSH_PORT=$(grep -i "$SERVER_NAME" $BACKUP_LIST | awk -F ' ' '{print $2}') REMOTE_SSH_PORT=$(grep -i "$SERVER_NAME" $BACKUP_LIST | awk -F ' ' '{print $2}')
REMOTE_PASSWORD=$(grep -i "$SERVER_NAME" $BACKUP_LIST | awk -F ' ' '{print $3}') REMOTE_DIRECTORY=$(grep -i "$SERVER_NAME" $BACKUP_LIST | awk -F ' ' '{print $3}')
REMOTE_PASSWORD=$(grep -i "$SERVER_NAME" $BACKUP_LIST | awk -F ' ' '{print $4}')
REMOTE_SERVER=$REMOTE_SERVER:$REMOTE_DIRECTORY
NOW=$(date +"%Y-%m-%d %H:%M:%S") NOW=$(date +"%Y-%m-%d %H:%M:%S")