Verify Samba mount? - SMB

This is a discussion on Verify Samba mount? - SMB ; Hi All - Is there an easy way to verify that a samba mount is active? If a windows computer reboots or is no longer accessible, sometimes a simple ls in the mounted directory seems to cause the server to ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Verify Samba mount?

  1. Verify Samba mount?

    Hi All -

    Is there an easy way to verify that a samba mount is active? If a
    windows computer reboots or is no longer accessible, sometimes a
    simple ls in the mounted directory seems to cause the server to hang.
    I need to put some code into a script to check to make sure the mount
    is active, and if not try to remount.

    Thanks,
    Marv

  2. Re: Verify Samba mount?

    > Is there an easy way to verify that a samba mount is active? If a
    > windows computer reboots or is no longer accessible, sometimes a
    > simple ls in the mounted directory seems to cause the server to hang.
    > I need to put some code into a script to check to make sure the mount
    > is active, and if not try to remount.
    >
    > Thanks,
    > Marv


    ps -eaf | grep smb



  3. Re: Verify Samba mount?

    On Mon, 01 Sep 2003 03:24:17 GMT, "JBEV" wrote:

    >> Is there an easy way to verify that a samba mount is active? If a
    >> windows computer reboots or is no longer accessible, sometimes a
    >> simple ls in the mounted directory seems to cause the server to hang.
    >> I need to put some code into a script to check to make sure the mount
    >> is active, and if not try to remount.
    >>
    >> Thanks,
    >> Marv

    >
    >ps -eaf | grep smb
    >


    Thanks for the assistance, but it did not work.

    Although this is a great way to show all mounts. The mounts show up
    even if they've been disconnected.

    To test, I created a mount to an XP computer. Did the ps command and
    it showed the mount point. Then I unplugged the XP computer from the
    network. Even after waiting a period of time, ps still shows the exact
    same info as before the computer was disconnected from the network.

    And then of cours if you try to do a ls, or really any command that
    reads this mounted directory, the shell locks up solid. Even a CTRL-C
    or CTRL-} does nothing. I have to come in as another session and kill
    the pid to the ls command.

    I'm thinking of writing a perl script that does an ls on the directory
    and after a certain time of no response, kill it's own pid.

    Just thought maybe there was an easy way to see if a mount point is
    active and responding.

    Thanks,
    Max

  4. Re: Verify Samba mount?

    On Mon, 01 Sep 2003 17:27:57 GMT, Marv wrote:

    >On Mon, 01 Sep 2003 03:24:17 GMT, "JBEV" wrote:
    >
    >>> Is there an easy way to verify that a samba mount is active? If a
    >>> windows computer reboots or is no longer accessible, sometimes a
    >>> simple ls in the mounted directory seems to cause the server to hang.
    >>> I need to put some code into a script to check to make sure the mount
    >>> is active, and if not try to remount.
    >>>
    >>> Thanks,
    >>> Marv

    >>
    >>ps -eaf | grep smb
    >>

    >
    >Thanks for the assistance, but it did not work.


    Well, I ended up writing a script that does the job well based on my
    testing so far. I guess this is the easiest weay to do it.

    #!/usr/bin/perl

    $share = "/share";


    eval {

    local $SIG{ALRM} = sub { die "Timeout" };
    alarm 5; #Timeout value in seconds

    # Run file command on mounted share
    chomp ($check = `file $share`);

    alarm 0;

    };

    if ($@ and $@ =~ /Timeout/) {

    $response = "Share is not active, timeout";

    } elsif ($check = '$share: directory') {

    $response = "$share is active";
    } else {

    $response = "Share is not active, reason: $check";

    }

    printf "$response\n";



+ Reply to Thread