On Mon, 8 Oct 2001, Steve Losen wrote:
awk '$2 == "tree" && $1 != "*" { print("quota report", $1) }' \ /filer-root/etc/quotas > /filer-root/etc/tmp/qtscript
rsh filer source /vol/vol0/etc/tmp/qtscript | grep '^tree'
This assumes that your filer is running a recent enough release of ONTAP to have the "source" command. If it doesn't, you can have the awk script do this:
print("rsh filer quota report", $1)
and then run the resulting script file through a unix shell.
I'm running ~5.3.6 on most of my filers, so that command is not available. I followed the same idea though, and simply had an awk statement construct a compound rsh command to the filer (sorry again... extreme line length warning):
% rsh nbc-na1 rdfile /etc/quotas | awk 'BEGIN { printf "rsh -n $FILER "; } ($2 == "tree") { printf("quota report %s \\; ", $1); } END { print " df \\; df -i | fgrep -v /.snapshot"; }' rsh -n $FILER quota report /depot \; quota report /local \; quota report /local-adm \; quota report /local-vs \; quota report /local-vs2.6 \; quota report /nbc \; quota report /fp-cnf \; quota report /tor-adm1 \; quota report /tor-dev1 \; quota report /tor-dev2 \; quota report /tor-fp1 \; quota report /tor-fp2 \; quota report /tor-vs1 \; quota report /tor-vs2 \; quota report /tor-vs3 \; quota report /tor-vs4 \; quota report /tor-vs5 \; quota report /tor-vs6 \; quota report /tor-vs7 \; quota report /tor-vs8 \; quota report /tor-vs9 \; quota report /tor-vs10 \; quota report /tor-vs11 \; quota report /tor-vs12 \; quota report /www-home \; quota report /www1 \; quota report /www2 \; quota report /cgi \; df \; df -i | fgrep -v /.snapshot
In the actual script, the initial "rsh $FILER rdfile /etc/quotas ..." command is backquoted to a variable first, then the variable is eval'd (thus the presence of the \'s). This satisfies two of my requirements: no need for anything besides awk and rsh on your admin host, and no need to have the filer root mounted. I do have to rely on the hidden "rdfile" command to get access to /etc/quotas, but I can live with that for now.