○ lshd 起動スクリプト

*lsh-2.0.4を自動起動させるスクリプトです
*完全コピーしないこと(エラーが出ることあり)

*"#" で始まる行はコメントとして解釈され、"$" の付いた文字は変数を表します
*スクリプトの先頭で, 処理を行うシェルを明示します (#!/bin/bash)
*# chkconfig: の#のあとに半角スペース
*# description: の#のあとに半角スペース
*. /  . はファイルを読み込むコマンド 後に半角スペース
*[ ] はテストコマンドです 半角スペースを忘れないように
*[ = ] テストコマンド内は = の前後に半角スペース
*環境変数等価式=の場合、前後に半角スペースをいれない
*A && B Aが正ならばBを実効
*A || B Aが為ならばBを実効
*$0 はスクリプト本体 $1は 第1引数
紫色部分 変更追加分

○/etc/rc.d/init.d/lshd

#!/bin/sh
#
# Version 2.0.4
#
# chkconfig: 345 81 29
# description: provides secure connections through untrusted networks
# lsh is based on the specification for ssh2 and should (eventually)
# be compatible.
#
# processname: lshd
#

# Source function library.
. /etc/rc.d/init.d/functions

[ -r /etc/sysconfig/lshdcfg ] && . /etc/sysconfig/lshdcfg

PATH=$PATH:/usr/local/sbin:/usr/local/bin

if [ ! -x /usr/local/sbin/lshd -o \
    ! -f /etc/lsh_host_key -o \
    ! -f /etc/lsh_host_key.pub ]
then
    cat 1>&2 <<EOF!
        ERROR: lsh is not installed properly
        check the existence of these files:
        /usr/local/sbin/lshd
        /etc/lsh_host_key
        /etc/lsh_host_key.pub

EOF!
    exit 1
fi

case "$1" in
    start)
        echo -n "Starting lshd secure connection service:"
        daemon lshd --daemonic $OPTIONS
        touch /var/lock/subsys/lshd
        echo
        ;;

    stop)
        echo -n "Stopping lshd secure connection service:"
        killproc lshd
        rm -f /var/lock/subsys/lshd
        echo
        ;;

    status)
        status lshd
        ;;

    restart|reload)
        $0 stop
        $0 start
        ;;

    *)
        echo "Usage: $0 {start|stop|restart|reload|status}"
        exit 1
esac

exit 0

lshd

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