I'm also using smbstatus to power of my server, if it's not in use, but
this bug prevents it.

I created this workaround script to ping the ip's (only ipv4) that
smbstatus reports, it reports the ip's as "online" or "offline". One
could also alter the script so the output is exactly like "smbstatus
-b", just showing the online clients only.


#!/bin/bash
# returns 1 if any  smb client is online, otherwise 0
function pingClient
{
    ping -c1 -W1 -q $1 &>/dev/null
    status=$( echo $? )
    if [[ $status == 0 ]] ; then
         #ping success
        echo "smb client $1 online"
        return 1
    else
         #ping failure
        echo "smb client $1 offline"
    fi
}
sudo /usr/bin/smbstatus -b | grep -o -P "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" | 
sort | uniq | while read -r a; do pingClient $a; done

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1392647

Title:
  smbstatus reports dead connection as active

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/samba/+bug/1392647/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to