In the Solaris Service XML
I am using a kill to signal a graceful shutdown
<exec_method type="method" name="stop" exec=":kill" timeout_seconds="60" />
This works great, except for the fact that it also kills the child processes, which mostly just die after a SIGTERM. Any of these will work
- Get the PID so I can use
exec="kill -SIGUSR1 $PID"
- Prevent SIGTERM from being sent to the children. (or at least not the grandchildren)
- Use some other signal
I would prefer not to set up a separate script that has to go figure out the pid. I will do this if I have to. I would prefer to get it from an environment variable, or use a SMF built in command.
exec=":kill -USR1"
does the trick. WithoutSIG
.I was looking for this when defining
method="refresh"
. jperkin set me straight with his example ofexec=":kill -HUP"
, whereas on SmartOS usingexec=":kill -SIGHUP"
resulted in"/sbin/sh[1]: exec: :kill: not found"
.Pretty sure you can just do
exec="kill -SIGUSR1"
.This is because both parent and child are under same contract ("man contract" for more info)
Make use of "ctrun" ("man ctrun" for more info), this will create child process under different contract. Doing this will prevent child from getting killed when parent is being killed.