[SATLUG] Looking for software

Daniel J. Givens daniel at rugmonster.org
Sun Jun 29 17:50:41 CDT 2008


On Sat, 28 Jun 2008 05:48:32 -0500 (CDT)
Borries Demeler <demeler at biochem.uthscsa.edu> wrote:

> Brad, thanks for the information. In my original e-mail I was looking
> for a free gpl program. I am thinking of a GPL project with a maturity
> like mailman or squirrelmail. Can you recommend any WebDAV application
> that falls into this category?

Hi Borries,

For a free (as in freedom), mature project that supports WebDAV,
you can look at Apache w/ mod_dav.

http://httpd.apache.org/docs/2.2/mod/mod_dav.html

Windows Explorer supports webdav via Web Folders.

For the email portion, you'll need to decide how fancy you need it to be. If
you don't need a very dynamic solution, you could do it easily using
inotifywatch from inotify-tools. Here's a script I cobbled together that would
do the trick.

---------BEGIN SCRIPT---------

#!/bin/bash

# $WATCH - Directory or file to watch
WATCH='/some/path'

# $LOG - File used to store event notifications
LOG='/tmp/watch_log'

# $RCPT - a list of space separated email addresses that will be recipients
#         of notifications
RCPT='user1 at domain.tld user2 at domain.tld'

inotifywait -m -e modify -e create -e move --format 'File %e %f - %T' --timefmt
'%D %r %Z' -q -r $WATCH | tee $LOG &

IFS='
'

while inotifywait -q -e modify $LOG; do
    sleep .25

    if (tail -n1 $LOG | grep MOVED_TO); then
        LINES=(`tail -n2 $LOG`)
        for I in 0 1; do
            if (echo "${LINES[I]}" | grep 'MOVED_FROM'); then
                OLD_NAME=`echo "${LINES[I]}" | cut -d' ' -f3`
                UPDATE="${LINES[I]}"
            elif (echo "${LINES[I]}" | grep 'MOVED_TO'); then
                NEW_NAME=`echo "${LINES[I]}" | cut -d' ' -f3`
                UPDATE="$UPDATE\n${LINES[I]}"
            fi
        done
        SUBJ="$OLD_NAME Moved to $NEW_NAME"
    else
        UPDATE=`tail -n1 $LOG`
        FILE=`echo $UPDATE | cut -d' ' -f3`
        if (grep MODIFY $LOG); then
            SUBJ="$FILE Modified";
        elif (grep CREATE $LOG); then
            SUBJ="New Document Added - $FILE";
        fi
    fi

    echo -e $UPDATE | mail -s "$SUBJ" $RCPT
done

---------END SCRIPT---------

This is a very crude solution, but a starting point for sure. Most scripting
languages can use inotify events, so taking this example could be made much
more robust using something else.

Regards,
Daniel


More information about the SATLUG mailing list