Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

Pretty sure you can just do exec="kill -SIGUSR1".

share|improve this answer
    
I get in the svc log: /usr/bin/kill[8]: kill: bad option(s). –  George Bailey Jul 1 '11 at 22:10
    
Err I meant exec=":kill -SIGUSR1" - not sure if you caught that. :( –  Scott Smith Jul 1 '11 at 23:33
    
I get /sbin/sh: :kill: not found. Sorry. If only there was a way not to propagate the kill to the children! That would make it so easy! –  George Bailey Jul 5 '11 at 16:18

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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