#!/bin/bash # File : Privoxy # # Purpose : A startupitem launch/relaunch/terminate script # # Copyright : Written by and Copyright (C) 2001-2012 the # Privoxy team. http://www.privoxy.org/ # # This program is free software; you can redistribute it # and/or modify it under the terms of the GNU General # Public License as published by the Free Software # Foundation; either version 2 of the License, or (at # your option) any later version. # # This program is distributed in the hope that it will # be useful, but WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. See the GNU General Public # License for more details. # # The GNU General Public License should be included with # this file. If not, you can view it at # http://www.gnu.org/copyleft/gpl.html # or write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA # # Modification : If you modify this file please consider whether your # changes ought to be passed back to the macsetup module. # . /etc/rc.common PRIVOXY_PATH=/usr/local/sbin PRIVOXY_PIDFILE=/var/run/privoxy.pid PRIVOXY_USER=privoxy PRIVOXY_CONFIG=/usr/local/etc/privoxy/config StartService () { if [ -x ${PRIVOXY_PATH}/privoxy ]; then if ! pid=$(GetPID privoxy); then echo "Starting privacy enhancing proxy" ${PRIVOXY_PATH}/privoxy --pidfile ${PRIVOXY_PIDFILE} --user ${PRIVOXY_USER} ${PRIVOXY_CONFIG} 2>&1 fi fi } StopService () { if pid=$(GetPID privoxy); then echo "Stopping privacy enhancing proxy" kill -TERM "${pid}" else echo "privoxy is not running." fi } RestartService () { if pid=$(GetPID privoxy); then echo "Restarting privacy enhancing proxy" kill -HUP "${pid}" else StartService fi } RunService "$1"