> Hello All,
> 
> I would like to be able to start/stop a daemon called super written in
> python.  I placed a script called super in the /etc/rc.d/init.d directory.
> This script looks like the majority of the other daemons located in the
> same directory with start, stop, status etc functions.  When the super
> daemon starts, it also starts 4 python threads.  So, using gtop, I can see
> that I have 6 processes started:  2 shell processes  and 4 python
> processes.  The stop function in my super script looks like this:
> 
> stop)
>      echo -n "Stopping super: "
>         killproc super
>         RETVAL=$?
>      echo
>      [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/super
> 
>      echo -n "Stopping python threads: "
>         killproc python
>         RETVAL=$?
>      echo
>      [ $RETVAL -eq 0 ]
>      ;;
> 
> The shell processes (taken care of by killproc super) kill fine.  The
> problem I am running into is with the command killproc python.  It tries to
> kill all 4 python threads but when the parent process is killed,the other
> three automatically die.  So I end up getting errors such as:
> "/etc/init.d/super:  kill: (1584)- no such pid" for each of the three pids.
> 
> Any thoughts on how to fix this or get around the three error messages?
> 
> Thanks in advance!
> Rebecca
>

Store the relevant PID into a file in /var/run - you will find lots there - and use 
this pid to kill and otherwise mutilate the daemon.

You can possibly get the correct PID from a shell script:
(
echo $$ >/var/run/super.pid
exec super
)


Note the use of parentheses here causes a new copy of the shell to start. You store 
the PID and then replace that shell with super.

Probably you can do it in Python too, but I have entirely enough trouble with other 
scripting languages.

Do you mind telling the curious what you're working on? It's not every day we see mail 
here from someone at Seagate, and some of us are dreadfully curious;-)


-- 
Cheers
John Summerfield
http://www2.ami.com.au/ for OS/2 & linux information.
Configuration, networking, combined IBM ftpsites index.

Microsoft's most solid OS: http://www.geocities.com/rcwoolley/

Note: mail delivered to me is deemed to be intended for me, for my disposition.





_______________________________________________
Redhat-devel-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

Reply via email to