rc.subr question

2006-10-27 Thread Volodymyr Kostyrko
I'm writing a custom script to start a linux daemon with LinuxThreads. 
The script starts daemon nicely, but on stopping it shows:


Stopping fmsadmin.
kill: 19790: No such process

This happens because all processes are actually threads and signalling 
one process is as good as signalling them all. But with this error 
wait_for_pids doesn't work which results in:


yehat# /usr/local/etc/rc.d/fmsadmin restart
Stopping fmsadmin.
kill: 19790: No such process
fmsadmin already running? (pid=19776 19777 19778 19779 19780 19781 19782 
19783 19784 19785 19786 19787 19788 19789 19791 19792 19793 19794 19795 
19796 19797 19926 19927).


What is the right way to describe such daemon in rc script? The daemon 
doesn't create any pid files and killing one of active processes does 
the thing.


--
Sphinx of black quartz judge my vow!
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: rc.subr question

2006-10-27 Thread Dan Nelson
In the last episode (Oct 27), Volodymyr Kostyrko said:
 I'm writing a custom script to start a linux daemon with
 LinuxThreads.  The script starts daemon nicely, but on stopping it
 shows:
 
 Stopping fmsadmin.
 kill: 19790: No such process
 
 This happens because all processes are actually threads and
 signalling one process is as good as signalling them all. But with
 this error wait_for_pids doesn't work which results in:
 
 yehat# /usr/local/etc/rc.d/fmsadmin restart
 Stopping fmsadmin.
 kill: 19790: No such process
 fmsadmin already running? (pid=19776 19777 19778 19779 19780 19781 19782 
 19783 19784 19785 19786 19787 19788 19789 19791 19792 19793 19794 19795 
 19796 19797 19926 19927).
 
 What is the right way to describe such daemon in rc script? The daemon 
 doesn't create any pid files and killing one of active processes does 
 the thing.

The best way is to record fmsadmin's primary pid to a file, either by
having it write one, or recording it in the rc script using the $!
variable (you'll need to write a custom start_cmd action to do this). 
Then if you set fmsadmin_pidfile=/path/to/pidfile in rc.conf,
rc.d/fmsadmin will send its kill signal to the pid listed in that file,
and will wait for just that pid to exit.
 
-- 
Dan Nelson
[EMAIL PROTECTED]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]