You are not logged in.
Can anyone show me an inotify-tools or similar example on doing what the subject suggests?
for example when text files are dropped in ~ folder then mv $textfile textfilefolder
the best would be if i could have a daemon running and put commands inside a configuration file that would act accordingly depending on what type of file appears.
yeah...
KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein
Offline
Offline
Also there's Sniper. I don't know how well it works though.
*Edit*
The code is there: http://code.l3ib.org/?p=sniper.git
Last edited by smoon (2007-09-15 19:19:59)
Offline
Thanks man! incrond i finally got working!
I haven't gotten the grips of everytjhing yet, but i have a script in my ~bin called the rather unimaginative mvifimage (couldn't think of another name in my drunken haze...)
#!/bin/bash
#what kind of file is it?
_FILETYPE=`file -i $1|sed 's/.*: //'`
if [ `echo $_FILETYPE|sed 's/\/.*//'` = "image" ];
then
mv $1 ~/pics
fi
(ofcourse i can extend it to other file types too...)
and then i launch that script from within incrontab -e:
/home/kris IN_CLOSE_WRITE,IN_NO_LOOP /home/kris/bin/mvifimage $@/$#
which automatically moves all fully-downloaded and closed picturefiles dropped in $HOME to my pics folder inside $HOME
woo fu***** hoo! Iv'e wished i had a program like that for ages and i couldn't get sniper to do what i wanted so... yes!
btw: anyone know a good place we could put this in the wiki?
Last edited by test1000 (2007-09-16 12:27:06)
KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein
Offline
sounds great but doesn't work for me...
i installed incron it from aur, added incron to the daemons array in rc.conf and added the line
/home/chris IN_CLOSE_WRITE echo "worx" > /home/chris/incrontest
to the incrontable via "incrontab -e"
according to htop, /usr/sbin/incrond is up and running.
i already tried to create the file /etc/incron.allow with my username in it (like you do with cron -> cron.allow)
but nothing happens. any idea?
thx
Last edited by clownfish (2007-09-24 19:11:21)
Offline
uhh i don't know why that doesn't work maybe one have to put the cmd into a script as the entry need to look like /path/to/hell BLA_BLA cmd $PARAMETERS
because with my script it still works... try it and you'll see...
KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein
Offline
jep, i tried that, but didn't work. i already wrote a script "drop-in" which is called by incron and executes a script according to the file type (mime-type and extension) of the given file. even with some tiny statistic capabilities...
but i never tried if incron works before i wrote the script, cause incron looked pretty simple.
now i have a script but incron is on strike.
Offline
/me = stupid
had a look at it again, tried with the script - now it works, except the script needs some debugging. maybe i forgot to call the script the first time i tried it: the script is placed in /home/chris/scripts/drop-in/drop-in; probably the first time i tried it, i just wrote /home/chris/scripts/drop-in (which is actually just the path to the script) into the incron table...
maybe i'll post the script when it's not that buggy anymore.
Offline