• 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:
What the hell is wrong with polling?
Calm down, calm down ... keep your wig on! ... Make the tea Terry :D (You'd have to be a certain age to get that .. PLUS I must add, I'm far too young 🤥:o_O:to get the Malcolm reference, sorry ;) )

I've nothing against polling. One of the many duties of my Raspberry Pi is to ping my VPS every minute of the day and night. In the Foxsat case it is just my preference to have the NAS tell the Foxsat when it's ready. Sorry for being difficult. I do want to keep it simple though. As Donald Trump once said "Trust me, I'm 'like' a smart person".

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.
Not necessarily. If I can successfully get the Foxsat to mount a share onto sdb1 via the Foxsat command line, a single bash script on the NAS should be enough to get the Foxsat to mount the NAS. Does that make sense? Files and folder permisions for the Foxsat are all "ftp". No way to change that as far as I can see, therefore I hopefully won't run into permission problems all things being equal. I've not tried yet though so .....
Currently trying to work out what the last 3 variables are :
/bin/mount -t cifs -o user=[lindex $Mount 3],password=[lindex $Mount 4] \"//[lindex $Mount 0]/[lindex $Mount 1]\" $MountPointRoot"
One of them has to be the share_name@NAS.IP.local, another the mount directory in sdb1, the remaining? I have no idea. Will have to wait until Sunday to experiment as my brain is old and tired right now.


Why are you assuming there is any?
No assumption, any page (even one I added myself) asks me to log in. It kind of looks like the login request you'd get from Apache2 when you've added auth to .htaccess, except that there is no .htaccess file in the /mnt/hd4/opt/webif folder, neither is there any entry for webif under /etc. Not that it matters now as I've ruled out that method in favour of SSH (which I can do). Mounting? See above.

Epilog :
I was planning to try and mount from the command line today when I get eventually get out of my pit, but unfortunately I've been collared, not that I'm complaining .. much .. well not much.

Thanks for the replies and the ideas. Very much appreciated
 
Sorry for being difficult.
It's your funeral, not ours. Do it whatever way you like. We can only advise (and any advice given is purely voluntary – there is no beef).

If I can successfully get the Foxsat to mount a share onto sdb1 via the Foxsat command line, a single bash script on the NAS should be enough to get the Foxsat to mount the NAS. Does that make sense?
Perhaps it does make some sense, if you mean the NAS script Telnets into the Foxsat to send the command for the Foxsat to run. But it doesn't really account for error responses, and the Telnet login credentials will have to be stored in the NAS script in the clear (if security bothers you). A significant reason for not injecting commands to a remote system are the security implications: file access permissions are lower risk than command access.

Fundamentally, the NAS should be an extension to the Foxsat's file system. It is therefore far more logical that the Foxsat is in control of the process. How do you plan to handle unmounting when the NAS drops out? What happens if the Foxsat wasn't responding at the time the NAS booted?
 
Back
Top