1998-11-10 02:56:01 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2003-02-04 04:08:36 +01:00
|
|
|
# $FreeBSD$
|
1998-11-10 02:56:01 +01:00
|
|
|
|
2003-02-04 04:08:36 +01:00
|
|
|
# PROVIDE: apache
|
|
|
|
# REQUIRE: DAEMON
|
|
|
|
# KEYWORD: FreeBSD shutdown
|
1998-11-10 02:56:01 +01:00
|
|
|
#
|
2003-02-04 04:08:36 +01:00
|
|
|
# NOTE for FreeBSD 5.0+:
|
|
|
|
# If you want this script to start with the base rc scripts
|
|
|
|
# move apache.sh to /etc/rc.d/apache
|
|
|
|
|
2003-06-08 11:56:51 +02:00
|
|
|
prefix=%%PREFIX%%
|
|
|
|
|
2003-02-04 04:08:36 +01:00
|
|
|
# Define the following apache_* variables in one of the following:
|
|
|
|
# /etc/rc.conf
|
|
|
|
# /etc/rc.conf.d/apache
|
2003-06-08 11:56:51 +02:00
|
|
|
# /etc/rc.conf.d/apache
|
2003-02-04 04:08:36 +01:00
|
|
|
#
|
2003-06-08 11:56:51 +02:00
|
|
|
# DO NOT CHANGE THESE DEFAULT VALUES HERE
|
1998-11-10 02:56:01 +01:00
|
|
|
#
|
2003-06-08 11:56:51 +02:00
|
|
|
apache_enable="YES" # Enable Apache
|
|
|
|
#apache_program="${prefix}/sbin/httpd # Location of httpd
|
|
|
|
apache_start="start_FP" # Subcommand sent to apachectl to control how
|
|
|
|
# httpd is started.
|
2003-02-04 04:08:36 +01:00
|
|
|
|
|
|
|
apache_doit ()
|
|
|
|
{
|
|
|
|
case $1 in
|
|
|
|
start) action=${apache_start} ;;
|
|
|
|
reload) action=graceful ;;
|
|
|
|
*) action=$1 ;;
|
|
|
|
esac
|
|
|
|
${ctl_command} ${action}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Create New FrontPage suidkey
|
1998-11-10 02:56:01 +01:00
|
|
|
|
|
|
|
new_key() {
|
|
|
|
|
2000-01-03 04:36:38 +01:00
|
|
|
CUR_UMASK=`umask`
|
2003-02-04 04:08:36 +01:00
|
|
|
skdir=${prefix}/frontpage/version%%FP_VER%%/apache-fp
|
|
|
|
PERL=%%PERL5%%
|
1998-11-10 02:56:01 +01:00
|
|
|
|
2003-02-04 04:08:36 +01:00
|
|
|
if [ -x ${prefix}/libexec/apache/mod_frontpage.so ]
|
1998-11-10 02:56:01 +01:00
|
|
|
then
|
2000-03-01 07:25:15 +01:00
|
|
|
|
|
|
|
#NOTE: We need Perl 5, to generate a new key
|
|
|
|
if [ -x ${PERL} ]
|
|
|
|
then
|
|
|
|
umask 077
|
|
|
|
${PERL} -e '@a=(split(//, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*-=_+")); print((map {$a[rand(scalar @a)]} (1..128)), "\n");' > $skdir/suidkey
|
|
|
|
umask ${CUR_UMASK}
|
|
|
|
fi
|
1998-11-10 02:56:01 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2003-02-04 04:08:36 +01:00
|
|
|
if [ -f /etc/rc.subr ]; then
|
1998-11-10 02:56:01 +01:00
|
|
|
|
2003-02-04 04:08:36 +01:00
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="apache"
|
|
|
|
rcvar=`set_rcvar`
|
|
|
|
command="${prefix}/sbin/httpd"
|
|
|
|
ctl_command="${prefix}/sbin/apachectl"
|
|
|
|
# pidfile=/var/run/httpd.pid
|
|
|
|
required_files="${prefix}/etc/apache/httpd.conf"
|
|
|
|
extra_commands="reload"
|
|
|
|
start_precmd="new_key"
|
|
|
|
start_cmd="apache_doit start"
|
|
|
|
stop_cmd="apache_doit stop"
|
|
|
|
restart_cmd="apache_doit restart"
|
|
|
|
reload_cmd="apache_doit reload"
|
1999-01-26 03:27:31 +01:00
|
|
|
|
2003-02-04 04:08:36 +01:00
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|
|
|
|
else
|
2003-06-08 11:56:51 +02:00
|
|
|
# Suck in the configuration variables.
|
|
|
|
if [ -z "${source_rc_confs_defined}" ]; then
|
|
|
|
if [ -r /etc/defaults/rc.conf ]; then
|
|
|
|
. /etc/defaults/rc.conf
|
|
|
|
source_rc_confs
|
|
|
|
elif [ -r /etc/rc.conf ]; then
|
|
|
|
. /etc/rc.conf
|
2003-02-04 04:08:36 +01:00
|
|
|
fi
|
2003-06-08 11:56:51 +02:00
|
|
|
fi
|
2003-02-04 04:08:36 +01:00
|
|
|
|
2003-06-08 11:56:51 +02:00
|
|
|
rc=0
|
|
|
|
|
|
|
|
case "${apache_enable}" in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
if [ -x ${prefix}/sbin/apachectl ]; then
|
|
|
|
new_key
|
|
|
|
${prefix}/sbin/apachectl ${apache_start} && echo -n ' httpd'
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
if [ -r /var/run/httpd.pid ]; then
|
|
|
|
${prefix}/sbin/apachectl stop && echo -n ' httpd'
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "usage: $0 {start|stop}" 1>&2
|
|
|
|
rc=64
|
|
|
|
;;
|
|
|
|
esac
|
2003-02-04 04:08:36 +01:00
|
|
|
;;
|
2003-06-08 11:56:51 +02:00
|
|
|
*)
|
|
|
|
rc=0
|
|
|
|
;;
|
2003-02-04 04:08:36 +01:00
|
|
|
esac
|
2003-06-08 11:56:51 +02:00
|
|
|
|
|
|
|
exit $rc
|
2003-02-04 04:08:36 +01:00
|
|
|
fi
|