Lines 1-17
Link Here
|
1 |
#!/bin/sh |
1 |
#!/bin/sh |
2 |
# |
2 |
# |
|
|
3 |
# $FreeBSD$ |
3 |
|
4 |
|
|
|
5 |
# PROVIDE: apache |
6 |
# REQUIRE: DAEMON |
7 |
# KEYWORD: FreeBSD shutdown |
4 |
# |
8 |
# |
5 |
# Create New FrontPage suidkey |
9 |
# NOTE for FreeBSD 5.0+: |
|
|
10 |
# If you want this script to start with the base rc scripts |
11 |
# move apache.sh to /etc/rc.d/apache |
12 |
|
13 |
# Define the following apache_* variables in one of the following: |
14 |
# /etc/rc.conf |
15 |
# /etc/rc.conf.d/apache |
16 |
# ${prefix}/etc/rc.conf.d/apache |
17 |
# |
18 |
# apache_enable - Set to YES to enable apache |
19 |
# |
20 |
# apache_program - Path to apache program |
21 |
# Default: ${prefix}/sbin/httpd |
22 |
# |
23 |
|
24 |
prefix=%%PREFIX%% |
25 |
|
26 |
# "${apache_start}" is the subcommand sent to apachectl to control how |
27 |
# httpd is started. It's value may be overridden in: |
28 |
# |
29 |
# @PKG_SYSCONFDIR@/apache_start.conf |
30 |
# /etc/rc.conf |
31 |
# /etc/rc.conf.d/apache, |
6 |
# |
32 |
# |
|
|
33 |
# in order of increasing precedence. Its possible values are "start" |
34 |
# and "start_FP", and defaults to "start_FP". |
35 |
# |
36 |
apache_start=start_FP |
37 |
if [ -f ${prefix}/etc/apache/apache_start.conf ] |
38 |
then |
39 |
. ${prefix}/etc/apache/apache_start.conf |
40 |
fi |
41 |
|
42 |
apache_doit () |
43 |
{ |
44 |
case $1 in |
45 |
start) action=${apache_start} ;; |
46 |
reload) action=graceful ;; |
47 |
*) action=$1 ;; |
48 |
esac |
49 |
${ctl_command} ${action} |
50 |
} |
51 |
|
52 |
# Create New FrontPage suidkey |
7 |
|
53 |
|
8 |
new_key() { |
54 |
new_key() { |
9 |
|
55 |
|
10 |
CUR_UMASK=`umask` |
56 |
CUR_UMASK=`umask` |
11 |
skdir=PREFIX/frontpage/versionFP_VER/apache-fp |
57 |
skdir=${prefix}/frontpage/version%%FP_VER%%/apache-fp |
12 |
PERL=PERL5 |
58 |
PERL=%%PERL5%% |
13 |
|
59 |
|
14 |
if [ -x PREFIX/libexec/apache/mod_frontpage.so ] |
60 |
if [ -x ${prefix}/libexec/apache/mod_frontpage.so ] |
15 |
then |
61 |
then |
16 |
|
62 |
|
17 |
#NOTE: We need Perl 5, to generate a new key |
63 |
#NOTE: We need Perl 5, to generate a new key |
Lines 25-59
Link Here
|
25 |
|
71 |
|
26 |
} |
72 |
} |
27 |
|
73 |
|
28 |
# |
74 |
if [ -f /etc/rc.subr ]; then |
29 |
# Main |
|
|
30 |
# |
31 |
|
75 |
|
32 |
if [ -x PREFIX/libexec/apache/mod_frontpage.so ] |
76 |
. /etc/rc.subr |
33 |
then |
|
|
34 |
MODULES="_FP" |
35 |
fi |
36 |
|
37 |
case "$1" in |
38 |
|
77 |
|
39 |
start) |
78 |
name="apache" |
40 |
if [ -x PREFIX/sbin/apachectl ] |
79 |
rcvar=`set_rcvar` |
41 |
then |
80 |
command="${prefix}/sbin/httpd" |
42 |
new_key |
81 |
ctl_command="${prefix}/sbin/apachectl" |
43 |
PREFIX/sbin/apachectl start${MODULES} && echo -n ' httpd' |
82 |
# pidfile=/var/run/httpd.pid |
|
|
83 |
required_files="${prefix}/etc/apache/httpd.conf" |
84 |
extra_commands="reload" |
85 |
start_precmd="new_key" |
86 |
start_cmd="apache_doit start" |
87 |
stop_cmd="apache_doit stop" |
88 |
restart_cmd="apache_doit restart" |
89 |
reload_cmd="apache_doit reload" |
90 |
|
91 |
# The below may be removed when load_local_rc_config is added to rc.subr |
92 |
|
93 |
if [ -f ${prefix}/etc/rc.conf.d/"$name" ]; then |
94 |
debug "Sourcing ${prefix}/etc/rc.conf.d/${name}" |
95 |
. ${prefix}/etc/rc.conf.d/"$name" |
44 |
fi |
96 |
fi |
45 |
;; |
|
|
46 |
|
97 |
|
47 |
stop) |
98 |
load_rc_config $name |
48 |
if [ -r /var/run/httpd.pid ] |
99 |
|
49 |
then |
100 |
if [ -z "${slapd_enable}" ] ; then |
50 |
PREFIX/sbin/apachectl stop && echo -n ' httpd' |
101 |
slapd_enable=yes |
51 |
fi |
102 |
fi |
52 |
;; |
|
|
53 |
|
103 |
|
54 |
*) |
104 |
# The above may be removed when load_local_rc_config is added to rc.subr |
55 |
echo "usage: $0 {start|stop}" 1>&2 |
105 |
# |
56 |
exit 64 |
106 |
# load_local_rc_config $name |
57 |
;; |
107 |
run_rc_command "$1" |
|
|
108 |
else |
109 |
case "$1" in |
110 |
|
111 |
start) |
112 |
if [ -x ${prefix}/sbin/apachectl ]; then |
113 |
new_key |
114 |
${prefix}/sbin/apachectl ${apache_start} && echo -n ' httpd' |
115 |
fi |
116 |
;; |
117 |
|
118 |
stop) |
119 |
if [ -r /var/run/httpd.pid ]; then |
120 |
${prefix}/sbin/apachectl stop && echo -n ' httpd' |
121 |
fi |
122 |
;; |
123 |
|
124 |
*) |
125 |
echo "usage: $0 {start|stop}" 1>&2 |
126 |
exit 64 |
127 |
;; |
58 |
|
128 |
|
59 |
esac |
129 |
esac |
|
|
130 |
fi |