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
?
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
?
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 executablepost-start
and stopping a job
pre-stop
post-stop
You know which one was called by, well, you're executing certain code you cannot be anywhere else :-)