This post is more than 5 years old
2 Intern
•
356 Posts
0
5908
March 20th, 2015 07:00
Command 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,
No Events found!



Peter_Sero
4 Operator
•
1.2K Posts
0
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/'
Peter_Sero
4 Operator
•
1.2K Posts
0
March 20th, 2015 08:00
No! spot the difference!
Peter_Sero
4 Operator
•
1.2K Posts
0
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
chjatwork
2 Intern
•
356 Posts
0
March 20th, 2015 08:00
Ahh Haa! your right!
kipcranford
125 Posts
0
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...
Peter_Sero
4 Operator
•
1.2K Posts
1
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
chjatwork
2 Intern
•
356 Posts
0
March 20th, 2015 08:00
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!
chjatwork
2 Intern
•
356 Posts
0
March 20th, 2015 08:00
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?
chjatwork
2 Intern
•
356 Posts
0
March 20th, 2015 09:00
Yes I saw this, but having a hard time translating that into the isi_for_array command:
isi_for_array 'tar -cvjf /ifs/css-backups/c702/'$(hostname)'_usr-backup.tar.bz2 /usr/' (Does not work, it still overwrites)
peglarr
99 Posts
0
March 20th, 2015 09:00
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!
chjatwork
2 Intern
•
356 Posts
0
March 20th, 2015 09:00
LOL, Brilliant... yes that is me
. Again, I am not so bright with the scripting, so thank you for baring with me
.
I found this to work as well:
isi_for_array 'tar -cvjf /ifs/css-backups/c702/"$(hostname)"_usr-backup.tar.bz2 /usr/'
I am getting the hang of it a little bit
Thank you again!
Peter_Sero
4 Operator
•
1.2K Posts
0
March 24th, 2015 06:00
That's the point, one needs to control which replacements take part first, right where you type isi_for_array,
and which ones occur later, upon nested execution in the remote node.
Highly recommend to watch The Matrix or Inception for more fanciful illustrations of "nested worlds"...
-- Peter