www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - check mountpoint status and send email on timeout/failure?

reply biocyberman <biocyberman gmail.com> writes:
For someone using NFS or some other remote filesystems, one may 
have experienced many times the nasty silent hang. For example, 
if I run `ls /mnt/remote/nfsmount`, and the remote NFS server is 
down while /mnt/remote/nfsmount was mounted, it will take very 
long time or forever for the `ls` command to return an error. 
Imagine if it were not `ls` but a data producing program, or 
user's home directly, it will be very inconvenient. Since I want 
to learn D, I want to write a program that does:
1. Check a path and to see it is a mount point. If it is not a 
mount point, try to mount it, and send an email. If it is a mount 
point, go to step 2.
2. If it is amount point, but fails to response after a certain 
time period (e.g 5 seconds), then send an email.

I know nothing about how to write it in D, or which library to 
use. So, some help please.
Dec 11 2017
parent Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Monday, 11 December 2017 at 10:50:17 UTC, biocyberman wrote:
 For someone using NFS or some other remote filesystems, one may 
 have experienced many times the nasty silent hang. For example, 
 if I run `ls /mnt/remote/nfsmount`, and the remote NFS server 
 is down while /mnt/remote/nfsmount was mounted, it will take 
 very long time or forever for the `ls` command to return an 
 error. Imagine if it were not `ls` but a data producing 
 program, or user's home directly, it will be very inconvenient. 
 Since I want to learn D, I want to write a program that does:
 1. Check a path and to see it is a mount point. If it is not a 
 mount point, try to mount it, and send an email. If it is a 
 mount point, go to step 2.
 2. If it is amount point, but fails to response after a certain 
 time period (e.g 5 seconds), then send an email.

 I know nothing about how to write it in D, or which library to 
 use. So, some help please.
You will need to use the system APIs for that I assume, nothing special for that. Just search for how to do what you want, probably in C, and translate that to D. As for the email, not so sure.
Dec 11 2017