Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
303 views
in Technique[技术] by (71.8m points)

python - How to trigger INCRON after file modified by py script executed by apache

I want a simple crontab rule such as :

/path/to/file IN_MODIFY echo "Incron triggered"

to function on a Linux VM that has a webserver.
The steps are :
1: Fill out forms in webpage to change datas.
2: Validating the forms activate a python script that opens, writes and closes the involved file
3: The incron rule should trigger but does not !

I can't change the way it works (Step1-2) and I got it to work with cron, but I want the trigger to be immediate rather than having to wait a few minutes for cron rule to start.

So far here is what I know/I've tried :
-Modifying the file manually DOES trigger the incron.
-Going with ls -lrt command shows timestamp modified to a new date (modification date).
-The involved file "belongs" to user "apache" and filepath too.
-Python script correctly opens/writes/closes the file (f.open(), f.write(), f.close()).
-I have tried the "IN_ALL_EVENTS", it does work manually, but still not when web modified.

Could someone guide me ?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...