I have created my own upstart script in /etc/init, which I can start and stop.

Now I want that service to be restarted when a file (/etc/my-app/restart-requested.txt) exists (or better is touched).

My solution with previous /etc/init.d/ service was a cron-job which regularily checked for the restart-file and called restart when the file existed.

Is there a better solution with upstart?


6 years later I've found out that upstarts guarantees that it first processes stop on and then start on:


This means that you can use

start on file FILE=/etc/my-app/restart-requested.txt EVENT=modify
stop on file FILE=/etc/my-app/restart-requested.txt EVENT=modify

Probably you don't need it anymore but I've faced same issue and found your question so maybe someone can use this solution in the future as well.

  1. Install incron
  2. Put /etc/my-app/restart-requested.txt IN_CLOSE_WRITE restart myservice into /etc/incron.d/myservice

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.