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
then I created a small script :
I check if the script is working:
succeed.txt is created.
After that, I configured incrontab :
Then I tried to test, I create a new file :
nothing happens. succeed.txt file is not generated.
What's wrong ?
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 ?