[QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qnap)

This is the best place for community developers to publish their genius work. Your Apps enrich the QNAP Turbo NAS.
User avatar
lucas72
Moderator
Posts: 369
Joined: Wed Sep 19, 2007 11:23 pm
Location: Rome - Italy

Re: [QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qna

Post by lucas72 »

Sounds very interesting and promising, as soon as I have time I'll give a look. Tks dude ;)
phreichmuth
Know my way around
Posts: 237
Joined: Fri Jan 09, 2009 12:17 am

Re: [QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qna

Post by phreichmuth »

And where in the section Téléchargement of the french forum can it be downloaded? The section offers two pages of topics but does not contains any post with incron or inotify.

Edit: must be this one, but is not in the named section: http://forum.qnapclub.fr/files/file/51- ... rs-ts-x09/
TS-253D, QTS 5.0
TS-128A, QTS 5.0
phreichmuth
Know my way around
Posts: 237
Joined: Fri Jan 09, 2009 12:17 am

Re: [QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qna

Post by phreichmuth »

Incron works for me for files directly copied into the folder. But it does not work for folders and subfolders interestingly.

My system_table looks the following:

Code: Select all

/share/Bilder/Originals IN_CREATE /share/Bilder/test.sh $@ $#
The script it executes if an object is added:

Code: Select all

#!/bin/sh
cp -rpl "$1/$2" "/share/Bilder/Test/" >> /share/Bilder/test.log
This creates hardlinks for the files directly in the observerd folder "/share/Bilder/Originals", that works fine.
If the object added is a folder, it creates the folder, but not the content of the folder.
If I run the command manually, it creates also hardlinks for the files in the folders and subfolders:

Code: Select all

cp -rpl "/share/Bilder/Originals/xxx" "/share/Bilder/Test/"
Whats the diffence here? How to create hardlinks to all files, directly in the observerd and the subfolders?
TS-253D, QTS 5.0
TS-128A, QTS 5.0
phreichmuth
Know my way around
Posts: 237
Joined: Fri Jan 09, 2009 12:17 am

Re: [QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qna

Post by phreichmuth »

O.k., something I made wrong: I created a FILE system_folder with the content in the last post. Interestingly it works anyway, but only for the first line of the file...

About the observed folder: I do not copy a folder into the observed one and put files into it later on, but I want to put folders with subfoders and files into the observed folder in one step.
Does IN_CREATE vs. IN_CLOSE_WRITE make the difference? Is a folder opened for writing untill moving content (files and folders) into it?
TS-253D, QTS 5.0
TS-128A, QTS 5.0
phreichmuth
Know my way around
Posts: 237
Joined: Fri Jan 09, 2009 12:17 am

Re: [QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qna

Post by phreichmuth »

incron does need to be recoursivelly, the script started by incron must be. The command of the script just has to start after every action in the folder has finished. That seems to be the trick. But inotify might be helpfull therefore...
TS-253D, QTS 5.0
TS-128A, QTS 5.0
phreichmuth
Know my way around
Posts: 237
Joined: Fri Jan 09, 2009 12:17 am

Re: [QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qna

Post by phreichmuth »

It does not work for my with multiple lines in any system table. Only the first line is executed.
But it works fine with multiple files with one line per file.
TS-253D, QTS 5.0
TS-128A, QTS 5.0
af0815
New here
Posts: 3
Joined: Mon Sep 19, 2011 11:37 pm

Re: [QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qna

Post by af0815 »

incrond didnt work.

TS212 Current firmware version: 3.6.1 Build 0302T

Install of incron with qpkg is correctly done. Actual Package from yesterday (20.4.2012) is used from the french site.
I created a Test config, but want to see the manpage of incrond and i got the following message

Code: Select all

[~] # /share/MD0_DATA/.qpkg/incron/bin/incrond -h
/share/MD0_DATA/.qpkg/incron/bin/incrond: /usr/lib/libstdc++.so.6: version `CXXABI_ARM_1.3.3' not found (required by /share/MD0_DATA/.qpkg/incron/bin/incrond)
/share/MD0_DATA/.qpkg/incron/bin/incrond: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /share/MD0_DATA/.qpkg/incron/bin/incrond)
i found a library in the package

Code: Select all

[~] # find / -name libstdc++.so
/mnt/ext/usr/lib/libstdc++.so
/share/MD0_DATA/.qpkg/Optware/lib/libstdc++.so
/share/MD0_DATA/.qpkg/incron/lib/libstdc++.so
should i only have to link the /share/MD0_DATA/.qpkg/incron/lib/libstdc++.so to /share/MD0_DATA/.qpkg/incron/lib/libstdc++.so.6 ?

greeting
Andi
sneaker8650
First post
Posts: 1
Joined: Fri Apr 20, 2012 2:52 pm

Re: [QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qna

Post by sneaker8650 »

incrond wont work for me.
i want to set a certain mtu value, after a pptp connection is established.
But i keep getting this error

incrond: /usr/lib/libstdc++.so.6: version `CXXABI_ARM_1.3.3' not found (required by incrond)
incrond: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by incrond)

i have no idea whats wrong. It would be great if somebody could help me please.
bendsch
Know my way around
Posts: 238
Joined: Fri Oct 23, 2009 3:20 am

Re: [QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qna

Post by bendsch »

tried to get this to work, but i have a two questions:

one: should this be a file or a folder with single files in it: /etc/incron.d/system-table

two: is there somewhere a log where i can se what incron is doing. i see that incrondaemon is running with the ps command. but i dont know if it acutally does something

-----

just realized that i am not able to turn the incron daemon completely off. so maybe changes in system_table were not reflected correctly.

when i do:
/etc/init.d/incron.sh setqpkg_stop
/etc/init.d/incron.sh setqpkg_disable
and then:
/etc/init.d/incron.sh status
shows that incrond is still running:

493 admin Z [incrond]
969 admin Z [incrond]
1787 admin Z [incrond]
1994 admin Z [incrond]
2036 admin Z [incrond]
3231 admin Z [incrond]
3525 admin Z [incrond]
3715 admin Z [incrond]
5296 admin Z [incrond]

also killall incrond wont help.
NASmodesl: TS-459 Pro+ , TS-251
bendsch
Know my way around
Posts: 238
Joined: Fri Oct 23, 2009 3:20 am

Re: [QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qna

Post by bendsch »

Hello Phillipe,

so now i got so far that incron is executing commands on a file event. but there seem to be some problems if i want to use the watchfolder via afp-share.

i just made two tests with a simple script that should copy a file to another location as soon as it finished writing and is closed (IN_CLOSE_WRITE):

1. copy a file from another directory of the nas to the watchfolder via linux console
result of inotifywait -m:

Code: Select all

/share/A2_Daten/Print/ CREATE PICT0008.JPG
/share/A2_Daten/Print/ OPEN PICT0008.JPG
/share/A2_Daten/Print/ MODIFY PICT0008.JPG
/share/A2_Daten/Print/ MODIFY PICT0008.JPG
/share/A2_Daten/Print/ MODIFY PICT0008.JPG
/share/A2_Daten/Print/ MODIFY PICT0008.JPG
/share/A2_Daten/Print/ CLOSE_WRITE,CLOSE PICT0008.JPG
file is succesfully copied

2. copy a file from my mac to the watchfolder via afp.
result of inotifywait -m:

Code: Select all

/share/A2_Daten/Print/ CREATE test.png
/share/A2_Daten/Print/ OPEN test.png
/share/A2_Daten/Print/ CLOSE_WRITE,CLOSE test.png
/share/A2_Daten/Print/ ATTRIB test.png
/share/A2_Daten/Print/ OPEN test.png
/share/A2_Daten/Print/ ATTRIB test.png
/share/A2_Daten/Print/ CLOSE_WRITE,CLOSE test.png
/share/A2_Daten/Print/ MODIFY test.png
/share/A2_Daten/Print/ MODIFY test.png
/share/A2_Daten/Print/ MODIFY test.png
/share/A2_Daten/Print/ ATTRIB test.png
/share/A2_Daten/Print/ ATTRIB test.png
/share/A2_Daten/Print/ ATTRIB test.png
/share/A2_Daten/Print/ CLOSE_WRITE,CLOSE test.png
/share/A2_Daten/Print/ ATTRIB test.png
/share/A2_Daten/Print/ ATTRIB test.png
/share/A2_Daten/Print/ OPEN,ISDIR 
/share/A2_Daten/Print/ CLOSE_NOWRITE,CLOSE,ISDIR 
/share/A2_Daten/Print/ CLOSE_WRITE,CLOSE test.png
copied file has the size of 0 bytes.

so it seems, that in the 2nd case the script is triggered before the file is fully written, because by copying over the network the finder closes an reopens the file a few times depending on the connection. how can i avoid that?

cheers bendsch.
NASmodesl: TS-459 Pro+ , TS-251
bendsch
Know my way around
Posts: 238
Joined: Fri Oct 23, 2009 3:20 am

Re: [QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qna

Post by bendsch »

managed to solve the issue with a script based on your proposal (comparing filesizes) if anyone is interested ....

incron-move.sh

Code: Select all

filesizeA=0
filesizeB=1
while [ $filesizeA != $filesizeB ]
do
filesizeA=`ls -l "$1/$2"  | awk  '{ print $5 }'` 
sleep 1
filesizeB=`ls -l "$1/$2"  | awk  '{ print $5 }'`
done

if [ $filesizeA == $filesizeB ]
then
sleep 1
mv "$1/$2"  "/share/Print/processing/" 
fi


thx a lot for your help. i think this is a very cool and useful qpkg. maybe you should promote it more. im sure there are people interested into that kind of stuff.

cheers and thx,

bendsch.
NASmodesl: TS-459 Pro+ , TS-251
phreichmuth
Know my way around
Posts: 237
Joined: Fri Jan 09, 2009 12:17 am

Re: [QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qna

Post by phreichmuth »

father_mande wrote:Hi,
Please, can you explain exactly what you do ???
I have run a test ...
remember first that root don't exist ... so I have put my line in /etc/config/incron.user/admin file ... the one managed for admin user ..
3 orders :

Code: Select all

[~] # cat /etc/config/incron.user/admin
/share/Public/inotify/test IN_CLOSE_WRITE /share/Public/inotify/test.sh $@/$#
/share/Public/inotify/etc IN_CREATE /share/Public/inotify/test.sh $@/$#
/share/Public/test IN_CREATE /share/Public/inot.sh $@ $# $%
[~] #
shell are simple ...

Code: Select all

[~] # cat /share/Public/inotify/test.sh
#!/bin/sh
echo $1 >> /share/Public/inotify/test.log
if [ -d "$1" ] ; then
echo "$1" " is a directory" >> /share/Public/inotify/test.log
else
echo "$1" " is a file" >> /share/Public/inotify/test.log
fi

[~] # cat /share/Public/inot.sh
#!/bin/sh
echo `date` " param 1 " $1 >> /share/Public/inot.log
echo `date` " param 2 " $2 >> /share/Public/inot.log
echo `date` " param 3 " $3 >> /share/Public/inot.log
[~] #
I have created one event for each : create a file in /share/Public/inotify/test , create a folder in /share/Public/inotify/etc
and create a folder in /share/Public/test

Code: Select all

[~] # cp /etc/inittab /share/Public/inotify/test/
[~] # mkdir /share/Public/inotify/etc/mudir
[~] # mkdir /share/Public/test/new_dir
[~] #
The result are OK :

Code: Select all

[~] # cat /share/Public/inotify/test.log
/share/Public/inotify/test/inittab
/share/Public/inotify/test/inittab  is a file
/share/Public/inotify/etc/mudir
/share/Public/inotify/etc/mudir  is a directory
[~] # cat /share/Public/inot.log
Wed Feb 8 17:06:27 CET 2012  param 1  /share/Public/test
Wed Feb 8 17:06:27 CET 2012  param 2  new_dir
Wed Feb 8 17:06:27 CET 2012  param 3  IN_CREATE,IN_ISDIR
[~] #
So all work fine with multiple command in a file ....

Philippe.
@ father_mande:

I am comming back to this old issue I had and still have, because I added configuration sets for incron on my NAS.

I stored the order files not under user name folder, but in the system_table folder. My order files look now like this:

1. order file: Create_Original-Bilder

Code: Select all

/share/Bilder/_Original-Bilder IN_CREATE /etc/config/incron.scripts/Original-Bilder.sh $@ $#
2. order file: Move_to_Original-Bilder

Code: Select all

/share/Bilder/_Original-Bilder IN_MOVED_TO /etc/config/incron.scripts/Original-Bilder.sh $@ $#
This works all fine, but if I put both orders into one file, only the first one was respected, means the script Original-Bilder.sh was only started if the pictures in /share/Bilder/_Original-Bilder have been created newly, but not if they have been moved there to.

I don't know, if this is because the files are placed in the system_table folder or if the module has a bug. However, it works fine with the multiple files.

Regards
Philipp
TS-253D, QTS 5.0
TS-128A, QTS 5.0
ppo
Starting out
Posts: 27
Joined: Wed Oct 24, 2012 8:06 pm

Re: [QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qnap)

Post by ppo »

Should I restart incron daemon each time after modifying list of directories to watch in /etc/config/incron.d/my.conf?
dwhite
Starting out
Posts: 16
Joined: Tue Sep 01, 2015 1:13 am

Re: [QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qnap)

Post by dwhite »

father_mande wrote:HI,

:lol: :lol: :lol: first post from 2009 January ??? I don't know that somebody continue to use this QPKG
I've just installed this great package to append uploaded files with the date and time to prevent overwrites. I'm creating a Share Link to email to friends and family to upload photos and videos. Currently if a file has the same name then it overwrites (e.g. IMG_0007.jpg). Still trying to figure out linux scripting but i'll get there eventually, fingers crossed!

Cheers,
Dom
dwhite
Starting out
Posts: 16
Joined: Tue Sep 01, 2015 1:13 am

Re: [QPKG] INCRON (for arm except TS-x09, x86 and x86_64 Qnap)

Post by dwhite »

Hopefully this thread is still alive as i've come across an issue i can't solve! I can't seem to get incron to run at all and I'm seeing the message:

[~] # /etc/init.d/incron.sh start
[~] # /share/MD0_DATA/.qpkg/incron/bin/incrond -h
/share/MD0_DATA/.qpkg/incron/bin/incrond: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /share/MD0_DATA/.qpkg/incron/bin/incrond)
[~] #

I know this has been mentioned earlier in the thread but i'm not sure how to address it.

Cheer
Dom
Post Reply

Return to “Community Apps”