○ portsentry起動スクリプト

*portsentry-2.0b1を自動起動するスクリプトです

*"#" で始まる行はコメントとして解釈され、"$" の付いた文字は変数を表します
*スクリプトの先頭で, 処理を行うシェルを明示します (#!/bin/bash)
*# chkconfig: の#のあとに半角スペース
*# description: の#のあとに半角スペース
*. /  . はファイルを読み込むコマンド 後に半角スペース
*環境変数等価式=の場合、前後に半角スペースをいれない
*$0 はスクリプト本体 $1は 第1引数
*ユーザ・オーナー・パーミッション (root root 700)

○/etc/rc.d/init.d/portsentry

#!/bin/bash
#
# chkconfig: 235 23 77
# description: portsentry2
#
# Source function library.
. /etc/rc.d/init.d/functions

# path to the binary.
portsentry=/usr/local/portsentry2/portsentry

# See how we were called
case "$1" in
    start)
        echo -n "Starting portsentry:"
        daemon $portsentry
        echo
        ;;
    stop)
        echo -n "Stopping portsentry:"
        killproc $portsentry
        echo
        ;;
    status)
        status $portsentry
        ;;
    restart)
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage:$0{ start|stop|restart|status }"
        exit 1
esac
exit 0

:portsentry

○ Copyright(c) 528p.com All Rights Reserved.