I am currently working with one server with a fixed ip address, and a backup server with a dynamic ip address.
The objective is to automize the backup process by running a cron job from the backup server.
I am using rsync for syncronizing the servers, however and since the ip is changing, the command need to be issued from the backup server so I may pass the new ip with it.
This is the script I first tried:
ipaddr=`ifconfig ppp0 | grep "inet addr:" | cut -d ":" -f 2 | cut -d " " -f 1`;
ssh -l webserver "rsync -e ssh -aRvvz / backup@$ipaddr:/srv/backup
--exclude=access.log --exclude=core --exclude=/var/lib/mysql --exclude=/dev --exclude=/proc --exclude=/mnt --exclude=/tmp --exclude=/var/spool/mail --exclude=/var/log --exclude=/var/www --exclude=/var/spool/MailS