I'm doing testing with apache editing the 000-defualt.conf file very often on vim, saving, and next running service apache2 restart.

What options do I've to automatically restart apache when a change to that file is made?

  • 2
    You may be able to use inotify in a manor similar to the method in this post
    – Aaron
    Commented Jan 9, 2016 at 4:13
  • 1
    Consider running reload action instead of restart. This takes less time and doesn't break existing connections. Only (un)loading modules needs full restart. Commented Jan 9, 2016 at 9:42

1 Answer 1


Simply use inotifywait (install your distribution's inotify-tools package):

while inotifywait -e close_write 000-defualt.conf; do service apache2 restart; done

You must log in to answer this question.

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