I need a script to shutdown differently depending on whether a user called stop or the system is going down.

Some background: I have two primary functionalities for ending a continuous process that I am running: stop and suspend. When I call stop myscript, I would like the stop functionality to be used. However, when the machine is shutting off, I would like the suspend functionality to be used. Is this possible with Upstart?

On a similar note, can I create a script-specific keyword that can specify my different shutdown types (such that I could say stop myscript AND suspend myscript)?


Upstart doesn't have any "suspend" stanza, what you can do is to set up two upstart script with different stop on stanza.

  • I fail to see how this would in any way solve my problem.... – MirroredFate Nov 6 '13 at 0:37
  • @MirroredFate your problem has no solution, or more like that the only solution is using two files. Either way your approach is not possible with the current development of upstart. You can check upstart.ubuntu.com/cookbook and verify yourself. – Braiam Nov 6 '13 at 0:39

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.