Home > Archive > PERL Beginners > November 2006 > How to check if a mount point exists.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to check if a mount point exists.
|
|
| Ravi Malghan 2006-11-16, 9:56 pm |
| Hi: I writing some logs into a directory which is mounted. =0A=0A>df -k=0A1=
99.11.255.50:/vol/rawdata=0A 335544320 18471160 3170731=
60 6% /actuate/rawdata=0A>=0A=0AIs there a way to check within perl =
if the mount point exists before I write?=0A=0AThanks=0Aray=0A=0A
| |
| John W. Krahn 2006-11-16, 9:56 pm |
| Ravi Malghan wrote:
> Hi: I writing some logs into a directory which is mounted.
>
> 199.11.255.50:/vol/rawdata
> 335544320 18471160 317073160 6% /actuate/rawdata
>
> Is there a way to check within perl if the mount point exists before I write?
if ( -e '/actuate/rawdata' ) {
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
| |
|
| In article <455CF115.6060103@telus.net>,
krahnj@telus.net (John W. Krahn) wrote:
> Ravi Malghan wrote:
>
> if ( -e '/actuate/rawdata' ) {
>
>
>
> John
That may not work, because if the volume is not mounted, the directory
is still there. I would use the mount command or df itself, and then
search for the directory, as in
if( grep m{/actuate/rawdata}, qx{/sbin/mount} ) { # this is where mount
# is on my system
# do this if it was true
}
Boyd
| |
| usenet@DavidFilmer.com 2006-11-17, 9:57 pm |
| ray wrote:
John replied:[color=darkred]
Boyd replied:[color=darkred]
> That may not work, because if the volume is not mounted, the directory
> is still there.
John knows that. The quality of John's answer, though, matched the
quality of the question (which did not ask how to know if the
filesystem is mounted - only whether the mount point exists). I'm sure
that John's intent was to motivate the user to rephrase the question
(and prehaps learn a bit of usenet wisdom as found in my tagline).
--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)
|
|
|
|
|