I do a df -k | grep foo
I am looking to see if my application foo is on this machine and if so run a script in /foo/lbin. Because of my disk layouts could have 248 file systems mounted on /foo/$filesystems so if I do
df -k | grep foo | awk '{Print $6}' | awk -F/ '(print $2}' will return foo 248 times.
Now up to 4 instances could be running
foo
foo1
foo2
foo3
and I only need to identify a single entity of foo to kick off the script so if foo2 and foo were running I need to kick off both /foo/lbin/script and /foo2/lbin/script
I could hardcode a case test for the 4 possible running areas but I have hundreds of these clusters and would rather do it once in a wrapper to determine which instance to run.
I have tried thinking of other ways to test if the application resides locally but df -k is extremely determinate.
so if my df returns
foo
foo
foo
foo
foo2
foo2
foo2
foo2
and the amount of returns vary from 48 to 246, what would be the easiest way to parse out foo and foo2?
I could write a tmp file.lock showing that I have already ran the script for this instance today but that seems clunky.
thanx,
bill