0

upstart has post-start, post-stop, etc... and script.

as i understood, the script part gets executed on initctl start X or initctl stop X or initctl status X.

so how do i know in script which one was called - start or stop?

b0x0rz
  • 101
  • 1
  • 1
  • 5

1 Answers1

0

The section names say it all: pre-stop is happening before job is stopped, and post-stop after the job has been stopped. Similarly, pre-start is executed before job is started and post-start after the job has started.

script (or exec) section is the main program.

So when starting a job:

  • pre-start
  • script or exec starts the main executable
  • post-start

and stopping a job

  • pre-stop
  • the main executable is killed
  • post-stop

You know which one was called by, well, you're executing certain code you cannot be anywhere else :-)

Tuminoid
  • 116
  • 1
  • 1
  • 2