In the /etc/incron.allow I added both:


Then I edited the incrontab so it looks like this:

/var/www/laravel/public/js/main.js IN_MODIFY yui-compressor -o /var/www/laravel/public/js/main.min.js /var/www/laravel/public/js/main.js

I think the issue may have something to do with permissions or perhaps groups but I'm not sure as I'm not getting anything when I check with tail -f /var/log/syslog

The /var/www/laravel/public folder is owned by USER_1 in group www-data. Incrond Inotify is done by the root user. When the main.js file is updated shouldn't Incrond Inotify run regardless of the current user since it's been set by root? Why isn't it working and how can I make it work with either root or USER_1?

1 Answer 1


This is probably an issue with the PATH environment in incron. Try to add the full path to your program like this (I am assuming yui-compressor resides in /usr/bin/)

/var/www/laravel/public/js/main.js IN_MODIFY /usr/bin/yui-compressor -o /var/www/laravel/public/js/main.min.js /var/www/laravel/public/js/main.js

to find out which is the full path to yui-compressor run the following in a terminal:

which yui-compressor

If you have problems with corrupted output files, consider to use IN_CLOSE_WRITE instead of IN_MODIFY because that fires only once the file is closed and not on every write operation. Depending on how your editor handles edits, that may be closer to what you want or not.

Edit: This should work fine under your USER_1 account. Just run incrontab -e in a terminal when logged in as USER_1 and add the line I gave above.

  • Doesn't seem to work due to permissions still.
    – Howard
    Jan 3, 2016 at 22:30
  • check that not only the folder but also the files in it are owned by USER_1. This is especially important if you use a build tool like grunt or jekyll which creates the files on the fly.
    – Thawn
    Jan 3, 2016 at 23:10
  • also, of course the files and folders have to have write (and the folders access) permissions.
    – Thawn
    Jan 3, 2016 at 23:11
  • You could try to put your command in a script and redirect the output to file to see what the problem is. such a script would contain a line like this: '/usr/bin/yui-compressor -o $1 $2 &>>/tmp/yui.log'. That should help debug why the command fails. Also, if 'yui.log' does not get created, the incron command is not executed.
    – Thawn
    Jan 3, 2016 at 23:16
  • one last tip would be to make sure that the incron daemon is running
    – Thawn
    Jan 3, 2016 at 23:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .