Hello all,
I have files at /var/dir1/dir2/fil1.log etc.,.
dir2 is symlinked to /export/xxx/dir3
I am trying to monitor the disk space of the mount where these log files are present.
How do I determine dynamically the actual directory of the log files and corresponding mount when I use df command.
I won't promise that there isn't some sort of degenerate chain of links on which this would choke. But it works in my tests. I should probably also have put in
a maximum number of links to follow (in case following the look with a
system call such as open would return "-ELOOP").
Thanks guys, I got a direction in implementing this from your responses.
I am seeing one issue.
There is a symlink within a symlinked directory which has to be determined dynamically. For example say -
/var/dir1/dir2 is symlinked to /export/xxx/yyy/dir3
and in turn /export/xxx/yyy is symlinked to /opt/zzz
In some places /export/xxx is symlinked to /opt/zzz
My aim is to determine dynamically the path of var/dir1/dir2 and get the result as /opt/zzz/dir2
I'm burning my head to put a script to recursively check all the directories, but going long and long.