View Full Version : [ubuntu] How can I check if my samba shares are being used

May 8th, 2009, 07:04 AM

I want to write a script that returns true if a samba share is in use. So I can tell if a samba client is connected to my computer and have it block shutdown.

Any help would be appreciated.

May 8th, 2009, 07:30 PM
If it is mounted to the drive you could cook something up from this point,

if [ $(mount | grep -c /mount/point) != 1 ]
# tests if /mount/point folder is currently mounted
zenity --error --text="no drive mounted"



hope thats what you mean.

May 9th, 2009, 07:25 AM
Thanks for the reply but I don't think that helps me. I need the samba server to check if its samba shares are being used by an xbox client and if they are block the computer from shutting down. The share folder is my external hdd and it is always mounted on the server.

May 13th, 2009, 02:12 AM
I found an alternative. I just wrote a script that returns true if it can ping the xbox. Now it doesn't shutdown if the xbox is turned on.

July 10th, 2011, 03:19 PM
Just for the record: you can check smbstatus to see whether a share (or a file on that share) is being used.