3 # This is file /etc/rc.d/init.d/privoxy and was put here
6 # chkconfig: 2345 84 09
8 # description: This shell script takes care of starting and stopping \
12 # ********************************************************************
14 # File : $Source: /cvsroot/ijbswa//current/privoxy.init,v $
16 # Purpose : This shell script takes care of starting and stopping
19 # Copyright : Written by and Copyright (C) 2001 the SourceForge
20 # Privoxy team. http://www.privoxy.org/
22 # Based on the Internet Junkbuster originally written
23 # by and Copyright (C) 1997 Anonymous Coders and
24 # Junkbusters Corporation. http://www.junkbusters.com
26 # This program is free software; you can redistribute it
27 # and/or modify it under the terms of the GNU General
28 # Public License as published by the Free Software
29 # Foundation; either version 2 of the License, or (at
30 # your option) any later version.
32 # This program is distributed in the hope that it will
33 # be useful, but WITHOUT ANY WARRANTY; without even the
34 # implied warranty of MERCHANTABILITY or FITNESS FOR A
35 # PARTICULAR PURPOSE. See the GNU General Public
36 # License for more details.
38 # The GNU General Public License should be included with
39 # this file. If not, you can view it at
40 # http://www.gnu.org/copyleft/gpl.html
41 # or write to the Free Software Foundation, Inc., 59
42 # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
45 # $Log: privoxy.init,v $
46 # Revision 1.8 2002/04/09 02:51:31 hal9
47 # Changed $JB to $PRIVOXY.
49 # Revision 1.7 2002/04/08 14:54:51 morcego
50 # Moved the chkconfig comments to the begining of the file, couse Linuxconf
51 # was getting confused with it where it was.
53 # Revision 1.6 2002/03/26 22:29:55 swa
54 # we have a new homepage!
56 # Revision 1.5 2002/03/25 06:14:18 morcego
57 # Removing the OPRG definition (no longer needed)
59 # Revision 1.4 2002/03/25 04:16:48 hal9
60 # Fix proper config file location.
62 # Revision 1.3 2002/03/24 19:12:15 hal9
63 # Fixed some naming conflicts.
65 # Revision 1.2 2002/03/24 11:40:14 swa
68 # Revision 1.1 2002/03/24 11:23:44 swa
71 # Revision 1.1 2002/03/22 20:53:03 morcego
72 # - Ongoing process to change name to JunkbusterNG
73 # - configure/configure.in: no change needed
75 # - TAR_ARCH = /tmp/JunkbusterNG-$(RPM_VERSION).tar.gz
76 # - PROGRAM = jbng@EXEEXT@
77 # - rh-spec now references as junkbusterng-rh.spec
78 # - redhat-upload: references changed to junkbusterng-* (package names)
79 # - tarball-dist: references changed to JunkbusterNG-distribution-*
80 # - tarball-src: now JunkbusterNG-*
81 # - install: initscript now junkbusterng.init and junkbusterng (when
83 # - junkbuster-rh.spec: renamed to junkbusterng-rh.spec
84 # - junkbusterng.spec:
85 # - References to the expression ijb where changed where possible
86 # - New package name: junkbusterng (all in lower case, acording to
87 # the LSB recomendation)
88 # - Version changed to: 2.9.13
90 # - Added: junkbuster to obsoletes and conflicts (Not sure this is
91 # right. If it obsoletes, why conflict ? Have to check it later)
92 # - Summary changed: Stefan, please check and aprove it
93 # - Changes description to use the new name
94 # - Sed string was NOT changed. Have to wait to the manpage to
96 # - Keeping the user junkbuster for now. It will require some aditional
97 # changes on the script (scheduled for the next specfile release)
98 # - Added post entry to move the old logfile to the new log directory
99 # - Removing "chkconfig --add" entry (not good to have it automaticaly
100 # added to the startup list).
101 # - Added preun section to stop the service with the old name, as well
102 # as remove it from the startup list
103 # - Removed the chkconfig --del entry from the conditional block on
104 # the preun scriptlet (now handled on the %files section)
105 # - junkbuster.init: renamed to junkbusterng.init
106 # - junkbusterng.init:
107 # - Changed JB_BIN to jbng
108 # - Created JB_OBIN with the old value of JB_BIN (junkbuster), to
109 # be used where necessary (config dir)
112 # - The config directory is /etc/junkbuster yet. Have to change it on the
113 # specfile, after it is changes on the code
114 # - The only files that got renamed on the cvs tree were the rh specfile and
115 # the init file. Some file references got changes on the makefile and on the
116 # rh-spec (as listed above)
118 # Revision 1.15 2002/03/09 15:05:58 swa
121 # Revision 1.14 2002/03/06 06:13:40 hal9
122 # Adapted for Andreas' changes for --user and --pidfile.
124 # Revision 1.13 2002/03/05 05:10:10 oes
125 # Changed pidfile path to conform with FHS
127 # Revision 1.12 2002/03/04 20:44:36 oes
128 # Changed to new cmdline syntax
130 # Revision 1.11 2001/12/30 14:07:32 steudten
131 # - Add signal handling (unix)
132 # - Add SIGHUP handler (unix)
133 # - Add creation of pidfile (unix)
134 # - Add action 'top' in rc file (RH)
135 # - Add entry 'SIGNALS' to manpage
136 # - Add exit message to logfile (unix)
138 # Revision 1.10 2001/11/05 21:30:23 steudten
139 # Make JB startup without & due to be a 'real' daemon right now.
140 # Make the script easy to change.
142 # Revision 1.9 2001/09/15 01:53:12 steudten
144 # Remove test for subsys flag in start. Some minor changes.
146 # Revision 1.8 2001/06/28 13:50:36 sarantis
147 # swap ?$ with $?; remove bogus ";;"
149 # Revision 1.7 2001/06/28 13:40:26 sarantis
150 # remove single quotes from $JB; it was not expanded.
152 # Revision 1.6 2001/06/28 13:38:42 sarantis
153 # formatting changes; individual return values are returned from the init script.
155 # Revision 1.5 2001/06/11 11:37:40 sarantis
156 # Minor editing changes.
158 # Revision 1.4 2001/06/09 09:14:11 swa
159 # shamelessly adapted RPM stuff from the newest rpm that
160 # RedHat provided for the JB.
162 # Revision 1.3 2001/05/25 10:12:44 oes
163 # Fixed default case in switch statement (# -> *)
165 # Revision 1.2 2001/05/24 07:52:24 swa
166 # added header. removed ^M.
169 # ********************************************************************/
172 # Source function library.
173 . /etc/rc.d/init.d/functions
175 . /etc/sysconfig/network
177 # Check that networking is up.
178 [ ${NETWORKING} = "no" ] && exit 0
180 PRIVOXY_PRG="privoxy"
181 PRIVOXY_BIN="/usr/sbin/$PRIVOXY_PRG"
182 PRIVOXY_CONF="/etc/$PRIVOXY_PRG/config"
183 PRIVOXY_USER="privoxy"
184 PRIVOXY_PID=/var/run/$PRIVOXY_PRG.pid
185 PRIVOXY_LOCK=/var/lock/subsys/$PRIVOXY_PRG
186 PRIVOXY="$PRIVOXY_BIN --user $PRIVOXY_USER.$PRIVOXY_USER --pidfile $PRIVOXY_PID $PRIVOXY_CONF"
189 ! [ -x $PRIVOXY_BIN ] && echo $"Can't find $PRIVOXY_BIN, exit." && exit 0
190 ! [ -f $PRIVOXY_CONF ] && echo $"Can't find $PRIVOXY_CONF, exit." && exit 0
192 # See how we were called.
196 echo -n $"Starting $PRIVOXY_PRG: "
197 if [ -f $PRIVOXY_PID ]; then
198 killproc $PRIVOXY_PRG && rm -f $PRIVOXY_LOCK $PRIVOXY_PID
200 [ $RETVAL != 0 ] && return $RETVAL
205 [ $RETVAL = 0 ] && touch $PRIVOXY_LOCK
211 echo -n $"Stopping $PRIVOXY_PRG: "
212 killproc $PRIVOXY_PRG && rm -f $PRIVOXY_LOCK $PRIVOXY_PID
226 if [ -f $PRIVOXY_PID ] ; then
227 kill -HUP `cat $PRIVOXY_PID`
237 # restart only if already running
238 if [ -f $PRIVOXY_PID ] ; then
249 if [ -f $PRIVOXY_PID ]; then
251 for i in `pidof $PRIVOXY_PRG` ; do
258 echo $"Usage: $PRIVOXY_PRG {start|stop|reload|restart|condrestart|status|top}"