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