Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
112 user(s) are online (64 user(s) are browsing Forums)

Members: 1
Guests: 111

rjd324, more...

Headlines

 
  Register To Post  

How to automatically dismount network shares when they are not reachable anymore?
Just popping in
Just popping in


See User information
I'm using NetFS on OS4 and when the remote computer is powered off/rebooted/crashed the Workbench is freezing on the local computer.

I've tried to create an Amiga DOS loop using 'ping' command and 'assign XXX dismount' but the loop is also freezed.

(By the way, it seems that ping is not like other Amiga commands and I can't get an error code so I had to use a trick)

This is a part of the script :

LAB Ping
WAIT 10
ping -c=3 secondamiga >t:pingresult
IF VAL `list t:pingresult lformat %l` GT 200
SKIP Ping BACK
ELSE
ASSIGN remotedh1: dismount
ASSIGN remotework: dismount
ENDIF

But it's not working as it freeze before the dismount... (Well, I'm far from a master of Amiga DOS)

So, does anyone knows a way to automatically dismount network shares when they are not reachable anymore?

A1200PPC/Sam440ep/Sam460ex/X1000/X5020 OS4.1
Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Just popping in
Just popping in


See User information
@davebraco

have you try the instructions from the netfs.doc?

Reconnect:
~~~~~~~~~~
If the server machine is rebooted, NetFS will automatically reconnect
to it when it is running again. However, there may be long timeouts
after a connection failure before NetFS gives up. This is a normal
for the TCP protocol that NetFS uses for its connections.

Sometimes NetFS may lose the connection to the server machine so that
it doesn't automatically try to reconnect. In that case, you can
try to reconnect by using the DiskChange-command.

You can also force NetFS to close the connection by sending ACTION_DIE
packet to it (for example with the 'die'-command that comes with MSH).

A3040/25 AmigaOS 3.2.2 | A1260BPPC AmigaOS 3.2.2/4.0
Sam440ep AmigaOS 4.1.FE | PegasosII/G3 AmigaOS 4.1.FE/MorphOS 3.17
MacMini1.5 MorphOS 3.17

Long Live Amiga
Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Just popping in
Just popping in


See User information
@davebraco

When the remote host isn't reachable anymore, it seems to leave the handler in a state leading to doslist lock too (which explains why the whole workbench or asl requesters and so on are locked too). Fortunately, you can still break smbfs process (ctrl-c).

Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Just popping in
Just popping in


See User information
@amije
I read the doc and I even contact the author. I didn't try the die command from the msh package before today.

The die command does not seems to function properly on OS4, and cannot function while the system is freezed (fab has written that in fact it's the doslist which is locked)

'Assign XXX dismount' can be run but does'nt eject the shared device.

I'm trying to create a script which on first double-click :
- ping the remote computer
- if reachable, then script mount the share otherwise it shows an alert
- while running the script test every 10 sec if the remote computer is still reachable. if not, the script eject the share (well, this is where i'm stuck)

If everything goes fine and you have finished with the remote computer. Second double-click dismount the share in a clean way.

So currently the script is working well until the remote computer is un-reachable.

@Fab
Do you know by any chance a way to get out of the 'doslist lock' situation?

Unlike smbfs, NetFS cannot be killed as the process is run on the remote computer.

A1200PPC/Sam440ep/Sam460ex/X1000/X5020 OS4.1
Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Just popping in
Just popping in


See User information
@davebraco

the problem is that netfs is very old and 68k. have you try other methods, ftp for example?
you can set ftpd in os4 tcp to act as a server, and run a client ftp on the other side.

A3040/25 AmigaOS 3.2.2 | A1260BPPC AmigaOS 3.2.2/4.0
Sam440ep AmigaOS 4.1.FE | PegasosII/G3 AmigaOS 4.1.FE/MorphOS 3.17
MacMini1.5 MorphOS 3.17

Long Live Amiga
Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Just popping in
Just popping in


See User information
@amije

Yes, I also use others ways too (mostly Samba, a bit ftp) but AmiNetFS has advantages too (faster, more Amiga, etc.). And to be honest, the fact that it get 'stuck' is not a big problem. You just have to think to dismount the remote device before switching off the computer.

I just would like to have a complete script.

Many thanks for your advices.

A1200PPC/Sam440ep/Sam460ex/X1000/X5020 OS4.1
Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Just can't stay away
Just can't stay away


See User information
@davebraco

Have you tried C:Dismount?

Best regards,

Niels

Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Just popping in
Just popping in


See User information
@nbache

Yes, but I will give it another try as I test it the device (ie. remotedh0:) and not on the volume (ie workbench:).

Anyway assign xxx dismount does the job, but maybe dismount will not be locked.

A1200PPC/Sam440ep/Sam460ex/X1000/X5020 OS4.1
Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Just can't stay away
Just can't stay away


See User information
@davebraco

The Dismount command does a more thorough cleanup than Assign DISMOUNT. It attempts to shut down the filesystem in question, while Assign DISMOUNT only removes the Doslist entry.

There is also a FORCE option, but do read the doc before using it.

Best regards,

Niels

Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Just popping in
Just popping in


See User information
@nbache

Cool, how did I miss that? (I always fount ASSIGN xxx DISMOUNT both counter-intuitive and incomplete because it only removes the Doslist entry.)

Regards,
- JCC

Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Just can't stay away
Just can't stay away


See User information
@JCC

Quote:

JCC wrote:
@nbache

Cool, how did I miss that?

The Documentation drawer is your friend ...

Best regards,

Niels

Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Just popping in
Just popping in


See User information
@nbache
Quote:

nbache wrote:
@JCC
The Documentation drawer is your friend ...

Real men don't read instructions
- Or -
If all else fails, read instructions. Note, I said "read", not "follow"

Normally I use it only to reference a shell command or configuration issue, I should "curl up" with the documentation drawer and see what else I've missed.

Regards,
- JCC

Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Home away from home
Home away from home


See User information
@all

heh, necro-posting...the kinks of some people...


Anyway.
I was looking for some automated process to (dis)mount shares myself for some time and didn't really find a (always) working solution (that was already available and didn't involve third-party software).

So, i wrote me an arexx script.

You only need smbfsv2.1+ from Olaf's github

Tested with Linux, Windumb and two NAS (FritzBox and Synology) shares.

Pros:
- Start options to use one script for all possible shares
- Configurable (the longer the delay time the longer it takes to get the system back from a dismounted share, i found that 10-15 seconds are bearable)
- (Dis)mounts shares on-the-fly
- Can be used in network-startup (i'm using it from there)
- Short
- Doesn't strain the system (at least, not for me)

Cons:
- Tested solely on an X1000 (with afore mentioned destination machines), so if anyone want to give it a go (with other NAS/shares/destination machine etc.) be my guest.
- Works only with sambav1 on the destination machine (smbfs limitation)
- If the share goes offline while there is disk access (read/write), Workbench will crash (at least, for me)
- Speed depends on the connection of the destination machine (e.g. my Synology NAS is slower than my Windumb PC, though both are connected directly into the router with a LAN cable)
- Changing the CACHE (or buffers) only impacts in directory scanning, all other speeds stay the same (more or less) -> tested with DiskSpeed on all destination shares, thus i went back to use it with the same setting all my other HDDs use, feel free to change.

Here's the script:
/*
MonitorShare.rexx 
Monitors and automatically (dis)mounts samba shares

Options:
v_address    - LAN Address of the machine which holds the share
v_share        - Name of the share
v_user        - User name that was given permission to
v_password    - Password (unfortunately not obfuscated)
v_delay        - number of seconds it should poll
*/

PARSE ARG v_address v_share v_user v_password v_delay

IF v_delay="" THEN DO
    
SAY "Error - argument(s) missing"
    
SAY "Usage: MonitorShare.rexx SHARE_IP SHARE_NAME USER PASSWORD SECS_POLL"
    
EXIT
END

p_share_mounted
=0
DO FOREVER
    p_address_available
=0
    CALL m_address_check
    
/*
    Use smbfs's own SETENV switch to save it's process number.
    */
    
IF p_address_available=1 THEN DO
        IF 
p_share_mounted=0 THEN DO
            
ADDRESS COMMAND 'Run >NIL: smbfs CACHE=128 MAXTRANSMIT=65535 RAISEPRIORITY TIMEOUT=10 SETENV USER='v_user' DEVICE=SMB_'v_share' VOLUME='v_share' SERVICE=//'v_address'/'v_share'/ PASSWORD='v_password
            p_share_mounted
=1
        END
    END
END

m_address_check
:
/*
Checking for up and running destination.
*/
DO WHILE p_address_available=0
    ADDRESS COMMAND 
'ping  >T:'v_share'.ping -c 3 -q 'v_address
    OPEN
(f_ping,'T:'v_share'.ping','R')
    DO WHILE ~
EOF(f_ping)
        
v_ping=READLN(f_ping)
        IF 
INDEX(v_ping,'loss')>0 THEN DO
            
v_packet_loss=COMPRESS(SUBWORD(v_ping,7,1),'%')
            
LEAVE
        END
    END
    CLOSE
(f_ping)
    IF 
EXISTS('T:'v_share'.ping'THEN
        ADDRESS COMMAND 
'delete quiet T:'v_share'.ping'
    
/*
    If address is available (again), leave loop and add share.
    */
    
IF v_packet_loss=0 THEN DO
        IF 
p_share_mounted=0 THEN
            p_address_available
=1
        
ELSE
            
ADDRESS COMMAND 'wait 'v_delay
    END
    
ELSE DO
        
/*
        If address is unavailable (anymore), remove share.
        */
        
p_address_available=0
        
IF p_share_mounted=1 THEN DO
            
/*
            Destination went offline. Break process.
            */
            
ADDRESS COMMAND 'break ${smbfs-process/smb_'v_share'}'
            
p_share_mounted=0
        END
    ADDRESS COMMAND 
'wait 'v_delay
    END
END


and here's how to use it from network startup
Quote:

Run >NIL: "Tools:System/Scripts/MonitorShare.rexx" 192.178.198.67 Windumb Raziel password 15


Notes:

I kept the smbfs command as simple as possible to reduce errors (one can always enhance or change it to one's needs)
e.g.
WORKGROUP will be handled by the server (as long as the share on it's destination was correctly added)


Edited by Raziel on 2022/6/2 16:11:10
People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Just can't stay away
Just can't stay away


See User information
@Raziel

working fine on my SAM460ex, I only needed to add "NETBIOS" to smbfs commandline, as I have/use a ooold WD BlueRing NAS.

and added just after "PARSE ARG"

IF v_delay="" THEN DO 
  
Say "argument(s) missing" 
  
Say "Usage: MonitorShare.rexx SHARE_IP SHARE_NAME USER PASSWORD SECS_POLL" 
  
Exit 
END

Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Home away from home
Home away from home


See User information
@jabirulo

Uhh, neat, i'm going to steal that

Thank you for the feedback

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Not too shy to talk
Not too shy to talk


See User information
@davebraco
Hello, I answer to original topics:

Now I tested NetFS revised, ver. 3.0. I have it on all AmigaOS4 and MorphOS machines.

For me it never freeze:
If I poweroff remote computer, it:
- on AmigaOS (Micro A1-C) disappers icon of remote disk from workbench, opened window with remote content is automatically closed. Only in assign command output is visible device netfs-peg1 ( or netfs-aone1 ). If I access this device from shell, receive warning "no disk present"

- on MorphOS (Mac Mini) Ambient icon disappears, but open window stays open, and I cannot access sub-directories. Assign command give the same result like AmigaOS.

If I power on remote computer again, desktop icons again appears without need of new mounting and I can continue with work normally.

So I recommend to install again newest NetFS version and try it again - it should't freeze.
Only thing with freeze (Guru meditation) is NetFSExplorer on AmigaOS4.

Tested on two remote computers X1000/AmigaOS, Pegasos 2/MorphOS

AmigaOS3: Amiga 1200
AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, AmigaOne X1000
MorphOS: Efika 5200b, Pegasos I, Pegasos II, Powerbook, Mac Mini, iMac, Powermac Quad
Go to top
Re: How to automatically dismount network shares when they are not reachable anymore?
Not too shy to talk
Not too shy to talk


See User information
Now I check again settings and find, that on all AmigaOS4 machines
I have disabled (Active=no) server amiganetfs / Datagram in Internet Preferences.

I forgot why I disabled it, maybe this causes lockups. Try to disable it, and have enabled only server amiganetfs / Stream.
Maybe there is some problem with UDP connections and timeouts, but have running only TCP (Stream) server is enough.

P.S.: if you are interested in my other NetFS settings, let me know.

AmigaOS3: Amiga 1200
AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, AmigaOne X1000
MorphOS: Efika 5200b, Pegasos I, Pegasos II, Powerbook, Mac Mini, iMac, Powermac Quad
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project