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
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 \.\d{1, 3}\.\d{ 1,3}\.\ d{1,3}" | sort | uniq | while read -r a; do pingClient $a; done
# 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}