Automatic shares: Unterschied zwischen den Versionen

Aus xinux.net
Zur Navigation springen Zur Suche springen
 
Zeile 9: Zeile 9:
 
SHARE=$(basename $2)
 
SHARE=$(basename $2)
 
case $EVENT in
 
case $EVENT in
IN_CREATE)
+
IN_CREATE|IN_MOVED_TO)
echo CREATE >> /tmp/iwatch
+
echo $EVENT $SMBPATH >> /tmp/iwatch
 
net conf addshare $SHARE $SMBPATH writeable=y guest_ok=n "SHARE share"
 
net conf addshare $SHARE $SMBPATH writeable=y guest_ok=n "SHARE share"
 
;;
 
;;
IN_DELETE)
+
IN_DELETE|IN_MOVED_FROM)
echo DELETE >> /tmp/iwatch
+
echo $EVENT $SMPATH >> /tmp/iwatch
 
net conf delshare $SHARE
 
net conf delshare $SHARE
 
;;
 
;;
 
esac
 
esac
 
</pre>
 
</pre>

Aktuelle Version vom 26. Juni 2014, 14:36 Uhr

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