debianの起動スクリプトに関する質問です。


http://discypus.jp/wiki/?Linux%2FDebian%2Fdrac%A4%C7POP%20before%20SMTP
http://goo.gl/Z0Nmx
上記を参考にして設定を行ったのですが、うまくいきませんでした。
下記に具体的に行った内容を記します。具体的な問題解決方法をご教授ください。

1.skeletonをコピーして雛形を作成
root@debian:/etc/init.d# cp skeleton key_remap

2.key_remapを下記のコメント欄のように編集
#do_start()を編集

3.key_remapに実行権限を付与
root@debian:/etc/init.d# chmod +x,+x,+x key_remap

4.runlevelに登録
root@debian:/etc/init.d# update-rc.d key_remap start 99 2 3 . stop 20 0 1 .
update-rc.d: using dependency based boot sequencing
update-rc.d: warning: key_remap start runlevel arguments (2 3) do not match LSB Default-Start values (2 3 4 5)
update-rc.d: warning: key_remap stop runlevel arguments (0 1) do not match LSB Default-Stop values (0 1 6)

この4番でつまっています。再起動してみましたが、有効になっていませんでした。

#debianのバージョン
root@debian:/etc/init.d# cat /etc/debian_version
6.0.2

よろしくお願い致します。

回答の条件
  • 1人5回まで
  • 登録:
  • 終了:2011/09/01 11:15:03
※ 有料アンケート・ポイント付き質問機能は2023年2月28日に終了しました。

回答0件)

回答はまだありません

  • id:puriketu99
    root@debian:/etc/init.d# cat key_remap
    #! /bin/sh
    ### BEGIN INIT INFO
    # Provides: skeleton
    # Required-Start: $remote_fs $syslog
    # Required-Stop: $remote_fs $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Example initscript
    # Description: This file should be used to construct scripts to be
    # placed in /etc/init.d.
    ### END INIT INFO

    # Author: Foo Bar <foobar@baz.org>
    #
    # Please remove the "Author" lines above and replace them
    # with your own name if you copy and modify this script.

    # Do NOT "set -e"

    # PATH should only include /usr/* if it runs after the mountnfs.sh script
    PATH=/sbin:/usr/sbin:/bin:/usr/bin
    DESC="Description of the service"
    NAME=daemonexecutablename
    DAEMON=/usr/sbin/$NAME
    DAEMON_ARGS="--options args"
    PIDFILE=/var/run/$NAME.pid
    SCRIPTNAME=/etc/init.d/$NAME

    # Exit if the package is not installed
    [ -x "$DAEMON" ] || exit 0

    # Read configuration variable file if it is present
    [ -r /etc/default/$NAME ] && . /etc/default/$NAME

    # Load the VERBOSE setting and other rcS variables
    . /lib/init/vars.sh

    # Define LSB log_* functions.
    # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
    # and status_of_proc is working.
    . /lib/lsb/init-functions

    #
    # Function that starts the daemon/service
    #
    do_start()
    {
    # Return
    # 0 if daemon has been started
    # 1 if daemon was already running
    # 2 if daemon could not be started
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
    || return 1
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
    $DAEMON_ARGS \
    || return 2
    xmodmap -e 'keycode 102 = Escape'
    xmodmap -e 'keycode 101 = BackSpace'
    xmodmap -e 'keycode 100 = Return'
    xmodmap -e 'keycode 47 = colon'
    xmodmap -e 'keycode 48 = semicolon'
    # Add code here, if necessary, that waits for the process to be ready
    # to handle requests from services started subsequently which depend
    # on this one. As a last resort, sleep for some time.
    }

    #
    # Function that stops the daemon/service
    #
    do_stop()
    {
    # Return
    # 0 if daemon has been stopped
    # 1 if daemon was already stopped
    # 2 if daemon could not be stopped
    # other if a failure occurred
    start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
    RETVAL="$?"
    [ "$RETVAL" = 2 ] && return 2
    # Wait for children to finish too if this is a daemon that forks
    # and if the daemon is only ever run from this initscript.
    # If the above conditions are not satisfied then add some other code
    # that waits for the process to drop all resources that could be
    # needed by services started subsequently. A last resort is to
    # sleep for some time.
    start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
    [ "$?" = 2 ] && return 2
    # Many daemons don't delete their pidfiles when they exit.
    rm -f $PIDFILE
    return "$RETVAL"
    }

    #
    # Function that sends a SIGHUP to the daemon/service
    #
    do_reload() {
    #
    # If the daemon can reload its configuration without
    # restarting (for example, when it is sent a SIGHUP),
    # then implement that here.
    #
    start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
    return 0
    }

    case "$1" in
    start)
    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
    do_start
    case "$?" in
    0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
    2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
    stop)
    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
    do_stop
    case "$?" in
    0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
    2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
    status)
    status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
    ;;
    #reload|force-reload)
    #
    # If do_reload() is not implemented then leave this commented out
    # and leave 'force-reload' as an alias for 'restart'.
    #
    #log_daemon_msg "Reloading $DESC" "$NAME"
    #do_reload
    #log_end_msg $?
    #;;
    restart|force-reload)
    #
    # If the "reload" option is implemented then remove the
    # 'force-reload' alias
    #
    log_daemon_msg "Restarting $DESC" "$NAME"
    do_stop
    case "$?" in
    0|1)
    do_start
    case "$?" in
    0) log_end_msg 0 ;;
    1) log_end_msg 1 ;; # Old process is still running
    *) log_end_msg 1 ;; # Failed to start
    esac
    ;;
    *)
    # Failed to stop
    log_end_msg 1
    ;;
    esac
    ;;
    *)
    #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
    echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
    exit 3
    ;;
    esac

    :
  • id:puriketu99
    プログラミングの師匠を募集しています

    師匠達(現在7名):http://twitter.com/#!/puriketu99/prk2master

    下記に関する私の人力検索上の質問をTwitterのリプライで通知しようと思っています。
    通知されることに差し支えがなければ、リプライをください。
    http://twitter.com/#!/puriketu99
    得意分野や何か一言ありましたら、書き添えてご連絡頂けると幸いです。

    ・Google App Engine for python
    ・python
    ・JavaScript
    ・PhoneGap(iPhone,Android)
    ・Debian/Linux
    ・Top Coder
    ・build bot
    ・Mac OS X
    ・各種API、ライブラリ
    ・その他周辺事項

    補足
    ・全てに精通している必要はありません
    ・もし、途中で通知がご面倒になった場合は、一言おっしゃっていただければ通知をしないようにします
    ・気が向いたときに回答していただければ充分です
    ・開発をしているときは高い頻度で質問することがあります
    ・初歩的な質問が多いです(http://q.hatena.ne.jp/puriketu99/questionlist)
    ・なるべく、答えを知っている人であればすぐに答えられるような質問をするようにしています
    ・何か不明点があれば、Twitterやコメント欄でお問い合わせください
  • id:tobeoscontinue
    自信がないのでコメントにて

    warningなので設定は有効になっていると思います。
    気持ちが悪いというのであれば
    update-rc.d key_remap start 99 2 3 4 5 . stop 20 0 1 6
    とするかkey_remapの
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6

    # Default-Start: 2 3
    # Default-Stop: 0 1
    とすることでwarningは出なくなるのではと思います。

    key_remapの
    NAME=daemonexecutablename
    を変更する必要があるでしょう。
    NAME=key_remap
    となるのでしょうがそうすると
    DAEMON=/usr/sbin/$NAME
    によって/usr/sbin/key_remapが必要になることになります。

    単にxmodmapをしたいだけであれば.xinitrcなどに記述したほうが簡単だと思います。
  • id:TransFreeBSD
    そもそも「daemonexecutablename」ってコマンドは実在しないのでは?
    だとしたらこのスケルトンは何もせず、すぐ終了するようになってますよ。
  • id:puriketu99
    回答ありがとうございます。
    とても参考になりました。
    月曜日に該当のPCで試してみます。

この質問への反応(ブックマークコメント)

「あの人に答えてほしい」「この質問はあの人が答えられそう」というときに、回答リクエストを送ってみてましょう。

これ以上回答リクエストを送信することはできません。制限について

回答リクエストを送信したユーザーはいません