Apache開機自動啟動的相關配置

2021-05-23 23:32:36 字數 866 閱讀 5679

# cd /etc/init.d

# vi apache2

加上以下指令碼

#!/bin/sh

# description: apache auto start-stop script.

# chkconfig: - 85 15

apache_home=/usr/local/apache2

apache_owner=root

if [ ! -f "$apache_home/bin/apachectl" ]

then

echo "apache startup: cannot start"

exit

ficase "$1" in

'start')

su - $apache_owner -c "$apache_home/bin/apachectl start"

;;'stop')

su - $apache_owner -c "$apache_home/bin/apachectl stop"

;;'restart')

su - $apache_owner -c "$apache_home/bin/apachectl restart"

;;esac

# chmod 755 apache

# chkconfig --add apache

# chkconfig --level 345 apache2 on

ok,測試apache

# service apache2 start

# service apache2 stop

# service apache2 restart

同時reboot os試一下apache是否開機自動執行了。

設定Apache開機自動啟動

如何讓apache隨linux啟動而啟動的方法做個總結,總結如下 1 cd etc init.d 2 vi apache2 3 貼上以下 bin sh description apache auto start stop script.chkconfig 85 15 apache home usr ...

centos設定Apache開機啟動

1 前言 2 設定方法 有兩種方法,一種是修改配置檔案,一種是通過新增啟動項。方法一 根據系統啟動的初始化過程,修改配置檔案 centos中的執行模式2 3 5都把 etc rc.d rc.local做為初始化指令碼中的最後乙個,所以使用者可以自己在這個檔案中新增一些需要在其他初始化工作之後,登入之...

開機自動啟動SVN

echo usage svn exit 1 esac chmod 755 etc rc.d init.d svn ln s etc rc.d init.d svn etc rc.d rc2.d s99svn ln s etc rc.d init.d svn etc rc.d rc3.d s99svn...