Automatic shares

Aus xinux.net
Zur Navigation springen Zur Suche springen

installation iwatch

samba script

  • /usr/local/sbin/dir-watch
#!/bin/bash
EVENT=$(echo $1 | cut -f 2 -d ,)
SMBPATH=$2
SHARE=$(basename $2)
case $EVENT in
IN_CREATE|IN_MOVED_TO)
echo $EVENT $SMBPATH >> /tmp/iwatch
net conf addshare $SHARE $SMBPATH writeable=y guest_ok=n "SHARE share"
;;
IN_DELETE|IN_MOVED_FROM)
echo $EVENT $SMPATH >> /tmp/iwatch
net conf delshare $SHARE
;;
esac