#!/bin/csh -f # constants set RemoteUser="rmbackup" set RemotePathPrefix="/backup/mysql/mysql" # figure out which MySQL server I am (number only) set MySQLNum=`/bin/uname -n | /usr/bin/cut -c6,7` set HostPrefix=`/bin/uname -n | /usr/bin/cut -c1-3` if ($HostPrefix != "mys") then exec echo "This isn't a mysql server." endif # get next number in the sequence @ NextMySQLNum = $MySQLNum + 1 # 0 pad the number if ($NextMySQLNum < 10 ) then set NextMySQLNum="0$NextMySQLNum" endif # hard coding this because mysql17 is different #if ($NextMySQLNum == "16") then # exec echo "rmbackup@mysql01.futurequest.net:/usr/local/z_stage_fright/mysql16/" #endif # see if I can backup to the next number in the sequence set Test=`/usr/bin/ssh -l rmbackup mysql${NextMySQLNum}.futurequest.net uname -n |& /usr/bin/cut -c6,7` if ("$Test" == "$NextMySQLNum") then echo "${RemoteUser}@mysql${NextMySQLNum}.futurequest.net:${RemotePathPrefix}${MySQLNum}/" else # since I can't backup to the next server I must be the last server so I will # loop back to #1 echo "${RemoteUser}@mysql01.futurequest.net:${RemotePathPrefix}${MySQLNum}/" endif