Shell Starting with incron

Hello everyone,

Trying to learn how to use incron, I don’t succeed in making an easy script.
Can someone explain what I did wrong?

What I want to do :
Watch any new file created in a specific folder
(/usr/home/theophile/)
Then, do something when a new file is created (for starting, create a file succeed.txt in the same place)

so I first installed incron


Code:
pkg install incron
sysrc incrond_enable="YES”
service incron start


then I created a small script :

vi /usr/home/theophile/create.sh

Code:
#! /bin/sh
touch /usr/home/theophile/succeed.txt

I check if the script is working:
sh /usr/home/theophile/create.sh

succeed.txt is created.


After that, I configured incrontab :
incrontab -e
Code:
/usr/home/theophile IN_CREATE /usr/home/theophile/create.sh

Then I tried to test, I create a new file :
touch /usr/home/theophile/test.txt

nothing happens. succeed.txt file is not generated.
What's wrong ?
 
Can't find any mention of a log file in incrond(8). But I did find a -n option that might be useful for debugging the issue:
Code:
    -n (or --foreground) option causes running on foreground. This is  use-
       ful especially for testing, debugging and optimization.
 
sh /script.sh works but sh -c /script.sh wont without +x
std/vixie cron needs +x iirc
dunno about incron but i assume it does too (you cant sh /bin/ls)
 
I added +x to the script, restarted incron service, still not generated the file.
I tried the -n option.. it waits, but nothing.
I'll find something else to solve my problem.

Thank you very much for your help guys.
 
Back
Top