
Solved!
Go to SolutionCommand Syntax using isi_for_array (tar, and $HOSTNAME)
Community,
I am trying to backup the following directories:
/usr/
/var/
/etc/mcp/override
per the pre upgrade steps. I need help with the syntax I would use to tar those directories using isi_for_array?
i.e..
tar -cvjf /ifs/backup/$HOSTNAME-usr-backup.tar.bz2 /usr/ (I need the HOSTNAME for every node to be represented in the naming of the file.)
My attempts to make this work netted me this output (-usr-backup.tar.bz2)
Remember this will have to work using isi_for_array.
Thank you,
Responses (12)
Solutions (0)
Peter_Sero
6 Operator
•
1169 Posts
4021
0
Posted March 20th, 2015 08:00
No! spot the difference!
Peter
Reply Peter_Sero
6 Operator
•
1169 Posts
4021
0
Posted March 20th, 2015 08:00
This is exactly why I gave the examples, to show how easily one can get it wrong.
And you have seen already how to do it correctly, use the single quotes (first example)
isilon-c702-1# isi_for_array 'echo $(hostname)'
isilon-c702-2: isilon-c702-2
isilon-c702-3: isilon-c702-3
isilon-c702-1: isilon-c702-1
isilon-c702-1# isi_for_array "echo $(hostname)"
isilon-c702-3: isilon-c702-1 <=== same filename
isilon-c702-2: isilon-c702-1 <=== same filename
isilon-c702-1: isilon-c702-1 <=== same filename
isilon-c702-1# isi_for_array echo $(hostname)
isilon-c702-2: isilon-c702-1 <=== same filename
isilon-c702-3: isilon-c702-1 <=== same filename
isilon-c702-1: isilon-c702-1 <=== same filename
Reply kipcranford
125 Posts
4021
0
Posted March 20th, 2015 08:00
You have to do something like this:
isi_for_array 'tar czf /ifs/`hostname`-crash.tgz /var/crash'
or you'll overwrite your tar file. So be careful...
Reply Peter_Sero
6 Operator
•
1169 Posts
4019
1
Posted March 20th, 2015 08:00
Try out these commands to see how tricky things can get with isi_for_array
# isi_for_array 'echo $(hostname)'
# isi_for_array "echo $(hostname)"
# isi_for_array echo $(hostname)
Note: Only one of these will suit your needs, and please try to understand the underpinnings before proceeding your backup efforts.
And please try to anticipate what happens to your cluster when /usr and /var get accidentally overwritten by a misdirected tar extraction...
Take good care
-- Peter
Reply Peter,
all worked!
isilon-c702-1# isi_for_array 'echo $(hostname)'
isilon-c702-2: isilon-c702-2
isilon-c702-3: isilon-c702-3
isilon-c702-1: isilon-c702-1
isilon-c702-1# isi_for_array "echo $(hostname)"
isilon-c702-3: isilon-c702-1
isilon-c702-2: isilon-c702-1
isilon-c702-1: isilon-c702-1
isilon-c702-1# isi_for_array echo $(hostname)
isilon-c702-2: isilon-c702-1
isilon-c702-3: isilon-c702-1
isilon-c702-1: isilon-c702-1
Your the man! Thank you!
Reply Peter,
Ok I ran the following command:
isi_for_array "tar -cvjf /ifs/css-backups/c702/$(hostname)_usr-backup.tar.bz2 /usr/"
Big mistake! Lucky this is just a test vm cluster. It put everything in the same .tar.bz2 file. I need there to be a individual .tar.bz2 for each node. Any suggestions?
Reply A key thing to remember is that isi_for_array is just another command executed in a shell, and thus subject to all the character manipulation that whatever shell you run it in has, in whatever node is executing it.
Have fun with your virtual Isilon!
Reply

Peter_Sero
6 Operator
•
1169 Posts
4021
0
Posted March 20th, 2015 09:00
That's kind of brilliant, the single quotes in the middle cancel out the outer quotes..
isi_for_array 'echo $(hostname)'
would translate to
isi_for_array 'tar -cvjf /ifs/css-backups/c702/$(hostname)_usr-backup.tar.bz2 /usr/'