tinyproxy/packaging/fedora/tinyproxy.init

107 lines
1.9 KiB
Plaintext
Raw Normal View History

2008-03-31 07:59:11 +08:00
#!/bin/sh
#
2008-05-01 22:17:58 +08:00
# tinyproxy Startup script for the tinyproxy server
2008-03-31 07:59:11 +08:00
#
# chkconfig: - 85 15
# description: small, efficient HTTP/SSL proxy daemon
2008-05-01 22:17:58 +08:00
#
2008-03-31 07:59:11 +08:00
# processname: tinyproxy
# config: /etc/tinyproxy/tinyproxy.conf
2008-05-01 22:17:58 +08:00
# config: /etc/sysconfig/tinyproxy
2008-03-31 07:59:11 +08:00
# pidfile: /var/run/tinyproxy.pid
2008-05-01 22:17:58 +08:00
#
# Note: pidfile is created by tinyproxy in its config
# see PidFile in the configuration file.
2008-03-31 07:59:11 +08:00
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
exec="/usr/sbin/tinyproxy"
prog=$(basename $exec)
2008-05-01 22:17:58 +08:00
config="/etc/tinyproxy/tinyproxy.conf"
2008-03-31 07:59:11 +08:00
2008-05-01 22:17:58 +08:00
[ -e /etc/sysconfig/tinyproxy ] && . /etc/sysconfig/tinyproxy
2008-03-31 07:59:11 +08:00
lockfile=/var/lock/subsys/tinyproxy
start() {
2008-05-01 22:17:58 +08:00
[ -x $exec ] || exit 5
[ -f $config ] || exit 6
2008-03-31 07:59:11 +08:00
echo -n $"Starting $prog: "
2008-05-01 22:17:58 +08:00
daemon $exec -c $config
2008-03-31 07:59:11 +08:00
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
# stop it here, often "killproc $prog"
killproc $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
2008-05-01 22:17:58 +08:00
reload() {
restart
}
force_reload() {
restart
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
2008-03-31 07:59:11 +08:00
case "$1" in
2008-05-01 22:17:58 +08:00
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
2008-03-31 07:59:11 +08:00
$1
;;
force-reload)
2008-05-01 22:17:58 +08:00
force_reload
2008-03-31 07:59:11 +08:00
;;
status)
2008-05-01 22:17:58 +08:00
rh_status
2008-03-31 07:59:11 +08:00
;;
2008-05-01 22:17:58 +08:00
condrestart|try-restart)
rh_status_q || exit 0
restart
2008-03-31 07:59:11 +08:00
;;
*)
2008-05-01 22:17:58 +08:00
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
2008-03-31 07:59:11 +08:00
exit 2
esac
2008-05-01 22:17:58 +08:00
exit $?