This post is more than 5 years old
2 Intern
•
356 Posts
0
2225
July 11th, 2017 04:00
Isilon - Gather All the group and user ownership for directories (Script)
Community,
I know this is a bit off of the reserve, but was wondering where is my advanced script resources (People) at? I could use some help with creating a script that will read in all the exports and locate the main directory its connected to and output the group and user owner for each directory. The export outputs is massive and contains over 100 exports for ID 2 alone. I am going to use that information to build a spreadsheet listing all the group and user owners for each of the exported directories on each cluster (For Management). Let me know if this is possible and if you don't mind sharing your work?
Thank you,



Peter_Sero
4 Operator
•
1.2K Posts
0
July 11th, 2017 11:00
Thanks! so spaces in path names are breaking the script, too
At least this can be fixed:
isi nfs exports list --format list | grep -o '/ifs.*' | xargs -I {} stat -f '"%Su","%Sg","%N"' {}
The other tricky part (which went wrong for you chjatwork) is the pattern for the grep -o,
there should be no '*' before /ifs
In my second version I left out the second "/",
so that an export right on /ifs is also matched.
And the zone can be omitted for sure. EDIT: the zone defaults to user's current zone,
i.e. zone option might be required. Just check with a plain "isi nfs exports list" as usual.
Peter_Sero
4 Operator
•
1.2K Posts
0
July 11th, 2017 10:00
Is this something you could start with?
# isi nfs exports list --zone System --format list | grep -o '/ifs/.*' | xargs stat -f '"%Su","%Sg","%N"'
Output on my virtual node:
"root","wheel","/ifs/data/test"
Of course such a one-line script has its limitations,
it will break with path names that contain newlines, for example...
Let me know if things need to get a bit more advanced.
-- Peter
chjatwork
2 Intern
•
356 Posts
0
July 11th, 2017 10:00
Peter,
I am at OneFS 7.2.1.4, what version are you at? I am not getting an output from what you provided.
[MyCLUSTER]# isi nfs exports list --format list | grep -o '*/ifs.*' | xargs stat -f ""%Su","%Sg","%N""
[MyCLUSTER]#
addisdaddy20
65 Posts
0
July 11th, 2017 10:00
chjatwork,
Something is wrong in your formatting. When I copied peters command it works. When I copied yours (looks same at first glance) I get nothing in my lab.
# isi nfs exports list --zone System --format list | grep -o '/ifs/.*' | xargs stat -f '"%Su","%Sg","%N"'
"root","wheel","/ifs/GopsNFS"
"test","Isilon Users","/ifs/home/test"
"root","wheel","/ifs/home"
"root","wheel","/ifs/.ifsvar/modules/fsa"
"root","wheel","/ifs/testnfs"
"root","wheel","/ifs/sub_test1"
"root","wheel","/ifs/sub_test2"
"root","wheel","/ifs/sub_test3"
"root","sys","/ifs/webster"
"krmagitz","sys","/ifs/turtle"
stat: /ifs/data/IsilonTest2/AI: stat: No such file or directory
"root","wheel","/ifs/celog"
"root","dba","/ifs/seaweed"
"root","dba","/ifs/urchin"
"root","dba","/ifs/jellyfish"
"root","dba","/ifs/starfish"
# isi nfs exports list --format list | grep -o '*/ifs.*' | xargs stat -f ""%Su","%Sg","%N""
#
chjatwork
2 Intern
•
356 Posts
1
July 11th, 2017 11:00
Peter,
That worked!
[MYCLUSTER]# isi nfs exports list --format list | grep -o '/ifs.*' | xargs -I {} stat -f '"%Su","%Sg","%N"' {}
"jaredb","wheel","/ifs/data/jared_test"
"hunt","wheel","/ifs/data/chris_test"
Many thanks!
sluetze
2 Intern
•
300 Posts
0
July 11th, 2017 11:00
--zone is missing