3 # This is file /etc/rc.d/init.d/privoxy and was put here
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.6 2002/03/26 22:29:55 swa
47 # we have a new homepage!
49 # Revision 1.5 2002/03/25 06:14:18 morcego
50 # Removing the OPRG definition (no longer needed)
52 # Revision 1.4 2002/03/25 04:16:48 hal9
53 # Fix proper config file location.
55 # Revision 1.3 2002/03/24 19:12:15 hal9
56 # Fixed some naming conflicts.
58 # Revision 1.2 2002/03/24 11:40:14 swa
61 # Revision 1.1 2002/03/24 11:23:44 swa
64 # Revision 1.1 2002/03/22 20:53:03 morcego
65 # - Ongoing process to change name to JunkbusterNG
66 # - configure/configure.in: no change needed
68 # - TAR_ARCH = /tmp/JunkbusterNG-$(RPM_VERSION).tar.gz
69 # - PROGRAM = jbng@EXEEXT@
70 # - rh-spec now references as junkbusterng-rh.spec
71 # - redhat-upload: references changed to junkbusterng-* (package names)
72 # - tarball-dist: references changed to JunkbusterNG-distribution-*
73 # - tarball-src: now JunkbusterNG-*
74 # - install: initscript now junkbusterng.init and junkbusterng (when
76 # - junkbuster-rh.spec: renamed to junkbusterng-rh.spec
77 # - junkbusterng.spec:
78 # - References to the expression ijb where changed where possible
79 # - New package name: junkbusterng (all in lower case, acording to
80 # the LSB recomendation)
81 # - Version changed to: 2.9.13
83 # - Added: junkbuster to obsoletes and conflicts (Not sure this is
84 # right. If it obsoletes, why conflict ? Have to check it later)
85 # - Summary changed: Stefan, please check and aprove it
86 # - Changes description to use the new name
87 # - Sed string was NOT changed. Have to wait to the manpage to
89 # - Keeping the user junkbuster for now. It will require some aditional
90 # changes on the script (scheduled for the next specfile release)
91 # - Added post entry to move the old logfile to the new log directory
92 # - Removing "chkconfig --add" entry (not good to have it automaticaly
93 # added to the startup list).
94 # - Added preun section to stop the service with the old name, as well
95 # as remove it from the startup list
96 # - Removed the chkconfig --del entry from the conditional block on
97 # the preun scriptlet (now handled on the %files section)
98 # - junkbuster.init: renamed to junkbusterng.init
99 # - junkbusterng.init:
100 # - Changed JB_BIN to jbng
101 # - Created JB_OBIN with the old value of JB_BIN (junkbuster), to
102 # be used where necessary (config dir)
105 # - The config directory is /etc/junkbuster yet. Have to change it on the
106 # specfile, after it is changes on the code
107 # - The only files that got renamed on the cvs tree were the rh specfile and
108 # the init file. Some file references got changes on the makefile and on the
109 # rh-spec (as listed above)
111 # Revision 1.15 2002/03/09 15:05:58 swa
114 # Revision 1.14 2002/03/06 06:13:40 hal9
115 # Adapted for Andreas' changes for --user and --pidfile.
117 # Revision 1.13 2002/03/05 05:10:10 oes
118 # Changed pidfile path to conform with FHS
120 # Revision 1.12 2002/03/04 20:44:36 oes
121 # Changed to new cmdline syntax
123 # Revision 1.11 2001/12/30 14:07:32 steudten
124 # - Add signal handling (unix)
125 # - Add SIGHUP handler (unix)
126 # - Add creation of pidfile (unix)
127 # - Add action 'top' in rc file (RH)
128 # - Add entry 'SIGNALS' to manpage
129 # - Add exit message to logfile (unix)
131 # Revision 1.10 2001/11/05 21:30:23 steudten
132 # Make JB startup without & due to be a 'real' daemon right now.
133 # Make the script easy to change.
135 # Revision 1.9 2001/09/15 01:53:12 steudten
137 # Remove test for subsys flag in start. Some minor changes.
139 # Revision 1.8 2001/06/28 13:50:36 sarantis
140 # swap ?$ with $?; remove bogus ";;"
142 # Revision 1.7 2001/06/28 13:40:26 sarantis
143 # remove single quotes from $JB; it was not expanded.
145 # Revision 1.6 2001/06/28 13:38:42 sarantis
146 # formatting changes; individual return values are returned from the init script.
148 # Revision 1.5 2001/06/11 11:37:40 sarantis
149 # Minor editing changes.
151 # Revision 1.4 2001/06/09 09:14:11 swa
152 # shamelessly adapted RPM stuff from the newest rpm that
153 # RedHat provided for the JB.
155 # Revision 1.3 2001/05/25 10:12:44 oes
156 # Fixed default case in switch statement (# -> *)
158 # Revision 1.2 2001/05/24 07:52:24 swa
159 # added header. removed ^M.
162 # ********************************************************************/
165 # Source function library.
166 . /etc/rc.d/init.d/functions
168 . /etc/sysconfig/network
170 # Check that networking is up.
171 [ ${NETWORKING} = "no" ] && exit 0
174 JB_BIN="/usr/sbin/$JB_PRG"
175 JB_CONF="/etc/$JB_PRG/config"
177 JB_PID=/var/run/$JB_PRG.pid
178 JB_LOCK=/var/lock/subsys/$JB_PRG
179 JB="$JB_BIN --user $JB_USER.$JB_USER --pidfile $JB_PID $JB_CONF"
182 ! [ -x $JB_BIN ] && echo "Can't find $JB_BIN, exit." && exit 0
183 ! [ -f $JB_CONF ] && echo "Can't find $JB_CONF, exit." && exit 0
185 # See how we were called.
189 echo -n $"Starting $JB_PRG: "
190 if [ -f $JB_PID ]; then
191 killproc $JB_PRG && rm -f $JB_LOCK $JB_PID
193 [ $RETVAL != 0 ] && return $RETVAL
198 [ $RETVAL = 0 ] && touch $JB_LOCK
204 echo -n $"Stopping $JB_PRG: "
205 killproc $JB_PRG && rm -f $JB_LOCK $JB_PID
219 if [ -f $JB_PID ] ; then
220 kill -HUP `cat $JB_PID`
230 # restart only if already running
231 if [ -f $JB_PID ] ; then
242 if [ -f $JB_PID ]; then
244 for i in `pidof $JB_PRG` ; do
251 echo $"Usage: $JB_PRG {start|stop|reload|restart|condrestart|status|top}"