[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debian-devel:14021] Re: start-stop-daemon



佐野@浜松です。

In <20010406081218.D99A153813@xxxxxxxxxxxxxxxxxxxxxx>,
  on "Fri, 6 Apr 2001 17:12:20 +0900',
   with "[debian-devel:14017] Re: start-stop-daemon",
 Kenshi Muto <kmuto@xxxxxxxxxxxxxxx> さん wrote:

> solid-pop3dのstandalone.cの
> 
>         switch (fork()) {
>             ...
>         };
> 
> のあとにでも/var/run/spop3d.pidを作ってこれにgetpid()の結果を
> 書き出すようにするルーチンを入れるというあたりが解決方法でしょうか。

たぶんこの武藤さんの提案のほうが正攻法だと思いますが
 quick dirty hack としては /etc/init.d/solid-pop3d の中で
なんとかしてしまう、というのでもいいかもしれません。

同時に複数が実行されているようだと動作を保証できませんが、
 ps ax で solid-pop3d が 1 つだけ表示されるようなら

 i=`ps x|grep solid-popd3|grep -v grep|awk '{ print $1 }'|head -1`

で pid を拾えると思うので、たとえば

> case "$1" in
>   start)
>         echo -n "Starting $DESC: "

         start-stop-daemon --start --quiet \
                 --exec $DAEMON -- $DAEMONCONF

         pid=`ps x|grep solid-popd3|grep -v grep|awk '{ print $1 }'|head -1`
	 echo $pid >/var/run/$NAME.pid

>         echo "$NAME."
>         ;;

(中略)

>   restart|force-reload)
>         #
>         #       If the "reload" option is implemented, move the "force-reload"
>         #       option to the "reload" entry above. If not, "force-reload" is
>         #       just the same as "restart".
>         #
>         echo -n "Restarting $DESC: "
>         start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid
>         sleep 1

          $0 start

>         ;;


としてしまうとか。

-- 
     # (わたしのおうちは浜松市、「夜のお菓子」で有名さ。)
    <kgh12351@xxxxxxxxxxx> : Taketoshi Sano (佐野 武俊)