I’m trying to do something like this, I need to take backup from 4 blades, and
all should be stored under the /home/backup/esa location, which contains 4
directories with the name of the nodes (like sc-1, sc-2, pl-1, pl-2). Each
directory should contain respective node’s backup information.
But I see that “from which node I execute the command, only that data is being
copied to all 4 directories”. any idea why this happens? My script is like this:
for node in $(grep "^node" /cluster/etc/cluster.conf | awk '{print $4}');
do echo "Creating backup fornode ${node}";
ssh $node source /etc/profile.d/bkUp.sh;
asBackup -b /home/backup/esa/${node};
done
Your problem is this piece of the code:
It does:
$nodesource /etc/profile.d/bkUp.shin the remote shellasBackupon the local host.This is not what you want. Change it to:
This does:
$nodesource /etc/profile.d/bkUp.sh; asBackup -b '/home/backup/esa/${node}'on the remote hostMake sure that
/home/backup/esa/${node}is a NFS mount (otherwise, the files will only be backed up in a directory on the remote host).Note that
/etc/profileis a very bad place for backup scripts (or their config). Consider moving the setup/config to/home/backup/esawhich is (or should be) shared between all nodes of the cluster, so changing it in one place updates it everywhere at once.Also note the usage of quotes: The single and double quotes make sure that spaces in the variable
nodewon’t cause unexpected problems. Sure, it’s very unlikely that there will be spaces in “$node” but if there are, the error message will mislead you.So always quote properly.