summaryrefslogtreecommitdiffhomepage
path: root/packaging/fedora/tinyproxy.init
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/fedora/tinyproxy.init')
-rw-r--r--packaging/fedora/tinyproxy.init79
1 files changed, 48 insertions, 31 deletions
diff --git a/packaging/fedora/tinyproxy.init b/packaging/fedora/tinyproxy.init
index dabe50f..9209674 100644
--- a/packaging/fedora/tinyproxy.init
+++ b/packaging/fedora/tinyproxy.init
@@ -1,25 +1,17 @@
#!/bin/sh
#
-# tinyproxy
+# tinyproxy Startup script for the tinyproxy server
#
# chkconfig: - 85 15
# description: small, efficient HTTP/SSL proxy daemon
+#
# processname: tinyproxy
# config: /etc/tinyproxy/tinyproxy.conf
+# config: /etc/sysconfig/tinyproxy
# pidfile: /var/run/tinyproxy.pid
-
-# http://fedoraproject.org/wiki/FCNewInit/Initscripts
-### BEGIN INIT INFO
-# Provides:
-# Required-Start:
-# Required-Stop:
-# Should-Start:
-# Should-Stop:
-# Default-Start:
-# Default-Stop:
-# Short-Description:
-# Description:
-### END INIT INFO
+#
+# Note: pidfile is created by tinyproxy in its config
+# see PidFile in the configuration file.
# Source function library.
. /etc/rc.d/init.d/functions
@@ -32,14 +24,17 @@
exec="/usr/sbin/tinyproxy"
prog=$(basename $exec)
+config="/etc/tinyproxy/tinyproxy.conf"
-[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+[ -e /etc/sysconfig/tinyproxy ] && . /etc/sysconfig/tinyproxy
lockfile=/var/lock/subsys/tinyproxy
start() {
+ [ -x $exec ] || exit 5
+ [ -f $config ] || exit 6
echo -n $"Starting $prog: "
- daemon $exec
+ daemon $exec -c $config
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
@@ -61,29 +56,51 @@ restart() {
start
}
+reload() {
+ restart
+}
+
+force_reload() {
+ restart
+}
+
+rh_status() {
+ status $prog
+}
+
+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
case "$1" in
- start|stop|restart|reload)
+ start)
+ rh_status_q && exit 0
+ $1
+ ;;
+ stop)
+ rh_status_q || exit 0
+ $1
+ ;;
+ restart)
+ $1
+ ;;
+ reload)
+ rh_status_q || exit 7
$1
;;
force-reload)
- restart
+ force_reload
;;
status)
- status $prog
+ rh_status
;;
- try-restart|condrestart)
- if status $prog >/dev/null ; then
- restart
- fi
- ;;
- reload)
- # If config can be reloaded without restarting, implement it here,
- # remove the "exit", and add "reload" to the usage message below.
- action $"Service $prog does not support the reload action: " /bin/false
- exit 3
+ condrestart|try-restart)
+ rh_status_q || exit 0
+ restart
;;
*)
- echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
- ;;
esac
+exit $?
+