お知らせ

  • 利用規約を守って投稿してください。また、よくある質問および投稿の手引きも参照してください。
  • メッセージの投稿にはアカウントが必要です。未登録の方は、ユーザ登録ページからアカウントを作成することができます。

#1 2009-09-23 11:17:47

Kenny Burrell
メンバ
登録日: 2009-06-14

gnump3d daemon control script

基本的な質問で恐縮です。もうすこしShellスクリプトを学べば、自分で出きるかもしれないのですが…

gnump3d:gnump3d-3.0をインストールしました。しかし、/etc/init.dの下のプロセス起動スクリプトがシェル、あるいはOSにあっていないようです。

/etc/init.d/gnump3d startあるいはstatus/stopが動きません。インストール時、適当なスクリプトとしてインストールファイルのrcfiles/redhatを/etc/init.d/gnump3dにコピーして使用しました。しかし、startでdaemonコマンドがない、statusでもエラーが出てプロセス状態を確認できません。

startは、daemonコマンドを外してとりあえずgnump3dの起動は出来ましたが、正式なスクリプトはないでしょうか?

redhat script:
#!/bin/sh
#
# mp3d:        This is an init script for RedHat distribution.
#
# Author:      Colin Tinker <[email protected]>
#
# chkconfig: 345 99 9
# description: gnump3d is a streaming mp3 daemon with a built in webserver.
# config: /etc/gnump3d/gnump3d.conf
# Source function library.
. /etc/rc.d/init.d/functions =>ここでエラー

[ -f /usr/bin/gnump3d ] || exit 0
[ -f /etc/gnump3d/gnump3d.conf ] || exit 0

PATH=/sbin:/bin:$PATH

# See how we were called.
case "$1" in
  start)
    echo -n "Starting gnump3 daemon: "
    daemon /usr/bin/gnump3d --background =>ここでエラー
    echo
    touch /var/lock/subsys/gnump3d =>ここでエラー
    ;;
  stop)
    echo -n "Shutting down gnump3 daemon: "
    killproc gnump3d
    echo
    rm -f /var/lock/subsys/gnump3d
    ;;
  status)
    status gnump3d =>ここでエラー
    ;;
  restart)
    $0 stop
    $0 start
    ;;
  *)
    echo "Usage: mp3d {start|stop|status|restart}"
    exit 1
esac

exit 0

オフライン

 

#2 2009-09-23 11:41:41

hmatsue
アドバイザ
登録日: 2009-03-10

Re: gnump3d daemon control script

8.04ならuniverseにパッケージがあるようです。
https://wiki.ubuntulinux.jp/UbuntuTips/Server/gnump3d
http://packages.ubuntu.com/search?keywords=gnump3d&searchon=names&suite=all&section=all
このパッケージからscriptを抜き取って使うとかでしょうか。
あとはソースパッケージからビルドしてしまうとか。
修正の要否や、要の場合の規模は判りませんが。。

オフライン

 

#3 2009-09-23 11:48:53

zagan
メンバ
登録日: 2008-08-12

Re: gnump3d daemon control script

Kenny Burrellさん による投稿:

redhat script:
---snip---
. /etc/rc.d/init.d/functions =>ここでエラー

どちらからダウンロード&インストールされました?

Debian Lennyにインストールしたものだと、/etc/init.d/gnump3dの内容は以下のようになってます。

#! /bin/sh
#
# gnump3d    simple streaming mp3/ogg server.
#
#        Written by Miquel van Smoorenburg <[email protected]>.
#        Modified for Debian GNU/Linux
#        by Ian Murdock <[email protected]>.
#
# Version:    @(#)skeleton  1.8  03-Mar-1998  [email protected]
#
# This file was automatically customized by dh-make on Sun, 24 Feb 2002 15:48:39 +0100

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/gnump3d
NAME=gnump3d
DESC=gnump3d

test -f $DAEMON || exit 0

set -e

#
#  Source any default options here.
#
if test -f  /etc/default/gnump3d ; then
   . /etc/default/gnump3d
fi


case "$1" in
  start)
    echo -n "Starting $DESC: "
    start-stop-daemon --background --start --quiet --make-pidfile --pidfile /var/run/$NAME.pid --exec $DAEMON -- $STARTUPOPTS
    echo "$NAME."
    ;;
  stop)
    echo -n "Stopping $DESC: "
    start-stop-daemon --oknodo --stop --quiet --pidfile /var/run/$NAME.pid
    rm -f /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 --oknodo --stop --quiet --make-pidfile --pidfile /var/run/$NAME.pid -- $STARTUPOPTS
    sleep 1
    rm -f /var/run/$NAME.pid
    sleep 1
    start-stop-daemon --background --start --quiet --make-pidfile --pidfile /var/run/$NAME.pid --exec $DAEMON

echo "$NAME."
    ;;
  *)
    N=/etc/init.d/$NAME
    # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
    echo "Usage: $N {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0

オフライン

 

#4 2009-09-23 17:16:10

hir0
メンバ
登録日: 2008-09-28

Re: gnump3d daemon control script

正式なスクリプトはないでしょうか?

# mp3d:        This is an init script for RedHat :distribution.

RedHatの様です、Ubuntuはdebian系になりますが別物です。

hmatsueさんの情報の様に8.04でパッケージ、8.10でソースの提供で終わっている様ですので別ソフトを探すかUbuntuのバージョンをソフトに合わせるのが成功法だと思うのですが「混ぜるな危険」を理解していられるならDebianのパッケージやUbuntuの別バージョンをゴニョゴニョと頑張ってみるのも良いかも。

オフライン

 

#5 2009-09-23 22:22:06

Kenny Burrell
メンバ
登録日: 2009-06-14

Re: gnump3d daemon control script

Debian版で動きました。有難うございました。

オフライン

 

Board footer

Powered by FluxBB