アプリ版:「スタンプのみでお礼する」機能のリリースについて

こんにちは、laser5linux7.2にapache1.3.26ソースからアップグレードしました。そうしたところPCを起動するだけでは自動的にhttpdが立ち上がらず、コマンドから/usr/local/apache/bin/apachectl startとしないとたちあがりません。これを最初から自動的に立ち上がらせるにはどうしたらよいでしょうか。xinetd.confかなにかを書き直さなければいけないのですか。

A 回答 (5件)

以下のスクリプトを/etc/rc.d/init.d/apacheというファイル名で保存し、chkconfig --add apacheを実行してください。



パスが違う場合は変更してください。
インデントが崩れているのでその辺りの修正もした方が見やすいです。

--ここから
#!/bin/bash
#
# Startup script for the Apache Web Server
#
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /usr/local/apache/log/httpd.pid
# config: /usr/local/apache/conf/access.conf
# config: /usr/local/apache/conf/httpd.conf
# config: /usr/local/apache/conf/srm.conf

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

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache/bin/apachectl
httpd=/usr/local/apache/bin/httpd
pid=/usr/local/apache/log/httpd.pid
prog=httpd
RETVAL=0

start() {
echo -n $"Starting $prog: "
$apachectl start >/dev/null 2>&1
RETVAL=$?
[ $RETVAL = 0 ] && touch /var/lock/subsys/httpd && success $"$prog startup" || failure $"$prog startup"
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
$apachectl stop >/dev/null 2>&1
RETVAL=$?
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd $pid && success $"$prog shutdown" || failure $"$prog shutd
own"
echo
}
reload() {
echo -n $"Reloading $prog: "
killproc $httpd -HUP
RETVAL=$?
echo
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f $pid ] ; then
stop
start
fi
;;
reload)
reload
;;
graceful|help|configtest)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit 1
esac

exit $RETVAL
--ここまで
    • good
    • 0

ANo.#4についてですが、自宅のサーバ(httpd-2.0.39)では正常に動作しているように見えますが、間違っている可能性があります。



また、apache-1.3.26用に修正しましたがミスがあるかもしれないので確認してください。
    • good
    • 0
この回答へのお礼

ありがとうございます。教えていただいたとおりにファイルを作って置いたところうまく行きました。ただし、最初実行権限を与えるのを忘れたために立ち上がりませんでした。

その他の方もありがとうございました。

お礼日時:2002/08/04 12:41

回答はすでに出ていますが、私はinit.dディレクトリに置くほうが好きです。



参考URL:http://www.zdnet.co.jp/help/tips/linux/l0481.html
    • good
    • 0

自動起動させるには、/etc/rc.d/rc.localに該当するコマンドを書き込めばいいだけです。

    • good
    • 0

一番安直には



/etc/rc.d/rc.local

に、

/usr/local/apache/bin/apachectl start

を書き加えてみては如何でしょう?
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!