3 ###########################################################################
5 # File : $Source: /cvsroot/ijbswa/current/privoxy-generic.init,v $
7 # Purpose : This script takes care of starting and stopping privoxy.
8 # It is supposed to work cross-platform and thus doesn't
9 # do too much. When packaging Privoxy it's recommended to
10 # write a platform-specific start script instead of using
13 # Copyright : Written by and Copyright (C) 2001,2002 the
14 # Privoxy team. http://www.privoxy.org/
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.
34 ###########################################################################
40 # Default-Start: 2 3 4 5
42 # Short-Description: Start privoxy at boot time
43 # Description: Start and stop the privacy-enhancing HTTP proxy privoxy.
46 # NOTE: This script may require editing to ensure proper location of
47 # config file, and the privoxy executable. Care should be taken to ensure
48 # logfile is writable by $P_USER (logfile is defined in config), and that
49 # there is suitable write access for $P_PIDFILE.
51 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/xpg4/bin:/usr/bin:/sbin:/bin
55 # Full path to location of Privoxy config file.
56 P_CONF_FILE=/usr/local/etc/privoxy/config
57 # Full path to PID file location. Location must be writable by
58 # whoever runs this script and by Privoxy itself.
59 P_PIDFILE=/var/run/privoxy.pid
60 # If uncommented, this script will try to run as USER=privoxy, which
61 # may require special handling of config, *.action, trust, logfile,
62 # jarfile, and pidfile.
65 # If a privoxy user is specified, lets try that. /bin/sh does not seem to
67 if [ 0 = `id -u` ]; then
68 if [ -n "$P_USER" ]; then
69 id $P_USER 2>/dev/null >/dev/null
71 P_USER_SETTINGS="--user $P_USER"
73 echo "User $P_USER doesn't exist, exiting."
77 # The user has sufficient rights, but $P_USER isn't set
78 echo "Running Privoxy as root is not recommended!"
82 # The user has insufficient rights to run Privoxy as $P_USER
83 # and may not be able to write or delete the PID file.
84 echo "You aren't root, expect trouble!"
88 if [ ! -f $P_CONF_FILE ]; then
89 echo "Can't find $P_CONF_FILE, exiting."
96 if [ -f $P_PIDFILE ]; then
97 if kill -0 `cat $P_PIDFILE`; then
98 echo "Error: $P_NAME is already running, exiting."
105 $P_DAEMON --pidfile $P_PIDFILE $P_USER_SETTINGS $P_CONF_FILE 2>/dev/null
107 if [ $? -eq 0 ]; then
108 echo "Starting $P_NAME, OK."
110 echo "Starting $P_NAME, Failed."
121 test ! -f $P_PIDFILE && echo "No $P_PIDFILE file found, exiting." && exit 1
122 kill `cat $P_PIDFILE` && rm -f $P_PIDFILE && \
123 echo "Stopping $P_NAME, OK." || echo "Stopping $P_NAME, failed."
127 echo "Usage: $0 {start|stop|restart}"