From 70329443abb6008ed004f3a90b79ba93ea492492 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 22 Nov 2009 17:34:33 +0000 Subject: script gets called now added smaple newfile.sh diff --git a/newfile.sh b/newfile.sh new file mode 100755 index 0000000..453b3d6 --- /dev/null +++ b/newfile.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +DIR=$1 +FILENAME=$2 + +if [ -z "$FILENAME" ]; then + exit 1; +fi + +echo "new file detected $DIR/$FILENAME" >> /tmp/newfile.log +sleep 5 +rm $DIR/$FILENAME >> /tmp/newfile.log 2>&1 + +exit 0 \ No newline at end of file diff --git a/rhdropbox.c b/rhdropbox.c index 0226c2f..5c3ca2d 100644 --- a/rhdropbox.c +++ b/rhdropbox.c @@ -94,7 +94,10 @@ int process_watch(int inotify_fd, read_buffer_t* buffer, watch_list_t* watch_lst log_printf(DEBUG, "ignoring inotify_rm_watch based events"); } else { -/* call script here */ + char* const argv[] = { opt->script_, path, event->len > 0 ? event->name : "", NULL }; + char* const evp[] = { NULL }; + uanytun_exec(opt->script_, argv, evp); + char buf[100]; snprintf(buf, 100, "new file in '%s', name='%s'", path, event->len > 0 ? event->name : ""); client_t* client; -- cgit v0.10.2