Skip to content Skip to sidebar Skip to footer

Python Script Not Work With Incron

incrontab -e /home/owen/file_to_be IN_ALL_EVENTS /home/owen/abc.py owen@desktop:~$ cat abc.py #!/usr/bin/env python # -*- coding: utf-8 -*- p = open('file_to_test', 'a+') p.writ

Solution 1:

Perhaps the script is working,but not as you expected... Put the full path to the file generated by the script, i.e.:

 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 p = open('/tmp/file_to_test', 'a+')
 p.write("test")
 p.close()

Then check than the file '/tmp/file_to_test' is generated, the problem can be the environment that uses incron to run the script.

Solution 2:

Your script doesn't seem to be executable, you need to use chmod to make it executable (chmod +x abc.py).

Post a Comment for "Python Script Not Work With Incron"