• The forum software that supports hummy.tv has been upgraded to XenForo 2.3!

    Please bear with us as we continue to tweak things, and feel free to post any questions, issues or suggestions in the upgrade thread.

Is it possible to trigger NASMount to mount a NAS when that NAS starts up?

TW8

New Member
I have been trying to mount my NAS via NASmount simply by switching the NAS on. I know it's a bit lazy.

I have worked out that I can mount my NAS from anywhere on my local network by going to the URL:
http://{Foxsat-IP}/plugin/NASMount/cgi-bin/DoSingleReMount.jim?MountNo=8'
and it will mount provided I am logged in. MountNo 8 holds the details of the NAS. It was 32 before I messed up DoSingleReMount.jim and had to do a re-install.

To automate the login process I have tried using PHP cURL to log in :
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
then :
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
It failed! Then :
curl_setopt($ch, CURLOPT_POSTFIELDS, 'username='.$username.'&password='.$password);
but I'm getting a 401.

I have no idea about webif auth. I see no evidence of stored cookies, so what am I missing? Session ID?

Thanks for your help.
 
What you actually need to do is download the package and look at the code. I haven't looked into it, but I expect it is coded in Jim and therefore readable. The repo is HERE. The discussion thread is HERE, but I don't think it will be much help (except perhaps for an explanation of what it does, rather than how it does it).

For what it's worth, I have indexed discussion relevant to individual HDR-FOX and HD-FOX packages HERE.
 
The OP needs to get it working with the command line on the Foxsat first i.e. the "mount -t cifs ..." stuff.
Mucking about with Curl just adds another unhelpful layer of confusion.

Causes of failure on the T2 are often lack of "unc" option, and looking at the files in the FoxSat's nasmount package, it doesn't specify this at all.
There are four places to possibly fix it (the code is sub-optimal) - two in DoMounts.jim and two in cgi-bin/DoSingleRemount.jim
References relating to the T2:
https://hummy.tv/forum/posts/109528/
https://hummy.tv/forum/posts/176477/
 
Thanks @Black Hole for your further reply. From reading one of the links you posted last night, it appears that 'network-shares-automount' PINGS the remote mount IP from the Foxsat at regular intervals. When it gets a reply, it attempts a mount. If there is packet loss or host is unreachable, it goes to sleep until time to try again. If I'm honest that wouldn't be my first choice, but it would make a good plan B. My ancient NAS normally only gets powered on once at the end of the day to do backups or to watch recordings. Running a cron job on the Foxsat every X minutes seems overkill in my circumstances. I haven't completely ruled it out and it is worthy of further consideration. I do prefer the idea that when the NAS is ready, it says "hi Hummy, I'm home!" to the Foxsat, that will cause the mount event to triggered.

Thanks also @prpr for your reply. The cURL side of things would be on the NAS side, but I can't get past webif auth yet. cURL that authorises okay with Apache2, doesn't work with webif. Maybe the form parameters 'username' and 'password' are not the same. However your idea to get a mount working from the Foxsat command line is good. If that works, I could get the NAS to SSH or telnet into the Foxsat with no webif involvement at all.

Thank you both for your ideas. I will have a read of the links Saturday or Sunday.. (or both!).
 
it appears that 'network-shares-automount' PINGS the remote mount IP from the Foxsat at regular intervals. When it gets a reply, it attempts a mount. If there is packet loss or host is unreachable, it goes to sleep until time to try again. If I'm honest that wouldn't be my first choice, but it would make a good plan B.
What the hell is wrong with polling? Your Foxsat is a computer, and what else are computers good at other than automating dull, repetitive jobs? Is there some reason it can't spare a few clock cycles every few minutes? Is your network going to break if there are too many no-response pings? 'Course not Malcomb.

Making the NAS "phone home" means reprogramming two units instead of one. It also means making the Foxsat react to an incoming signal of some kind, when polling is self-contained. Your choice, but I recommend not making it difficult.

FWIW, my units are pinging each other all the time, and yet comparatively rarely used. Nothing has burned down.
 
Last edited:
Back
Top