freebsd-ports/www/polipo/files/polipo.sh.in
Renato Botelho 709be1a43a Fixes for www/polipo
1. avoid error message "502 Range without partial content"
2. shutdown polipo on system shutdown

PR:		ports/84167
Submitted by:	Frank Behrens <frank@pinky.sax.de> (maintainer)
2005-07-27 15:21:44 +00:00

45 lines
796 B
Bash

#!/bin/sh
#
# PROVIDE: polipo
# REQUIRE: NETWORK
# BEFORE: NETWORK
# KEYWORD: FreeBSD shutdown
. %%RC_SUBR%%
name=polipo
rcvar=`set_rcvar`
polipo_enable=${polipo_enable:-"NO"}
polipo_flags=${polipo_flags:-""}
polipo_user=%%USER%%
polipo_group=%%GROUP%%
pidfile=%%PPIDFILE%%
config_file=%%PCONFIGDIR%%config
required_files=$config_file
command="%%PREFIX%%/bin/polipo"
config_args="-c ${config_file}"
command_args="$config_args daemonise=true pidFile=${pidfile}"
extra_commands=expire
expire_cmd=expire_cmd
expire_cmd () {
if [ $rc_pid ]; then
kill -USR1 $rc_pid
# allow polipo to write out all files
sleep 5
fi
su -m ${polipo_user} -c "${command} ${config_args} -x"
if [ $rc_pid ]; then
kill -USR2 $rc_pid
fi
}
load_rc_config $name
run_rc_command "$1"