*** empty log message ***
[OSXPackageBuilder.git] / pkg content skeleton / Library / StartupItems / Privoxy / Privoxy
1 #!/bin/bash
2
3 # File        :  Privoxy
4 #
5 # Purpose     :  A startupitem launch/relaunch/terminate script
6 #
7 # Copyright   :  Written by and Copyright (C) 2001-2012 the
8 #                Privoxy team. http://www.privoxy.org/
9 #
10 #                This program is free software; you can redistribute it
11 #                and/or modify it under the terms of the GNU General
12 #                Public License as published by the Free Software
13 #                Foundation; either version 2 of the License, or (at
14 #                your option) any later version.
15 #
16 #                This program is distributed in the hope that it will
17 #                be useful, but WITHOUT ANY WARRANTY; without even the
18 #                implied warranty of MERCHANTABILITY or FITNESS FOR A
19 #                PARTICULAR PURPOSE.  See the GNU General Public
20 #                License for more details.
21 #
22 #                The GNU General Public License should be included with
23 #                this file.  If not, you can view it at
24 #                http://www.gnu.org/copyleft/gpl.html
25 #                or write to the Free Software Foundation, Inc.,
26 #                51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
27 #                USA
28 #
29 # Modification : If you modify this file please consider whether your 
30 #                changes ought to be passed back to the macsetup module.
31 #
32
33 . /etc/rc.common
34
35 PRIVOXY_PATH=/usr/local/sbin
36 PRIVOXY_PIDFILE=/var/run/privoxy.pid
37 PRIVOXY_USER=privoxy
38 PRIVOXY_CONFIG=/usr/local/etc/privoxy/config
39
40 StartService ()
41 {
42     if [ -x ${PRIVOXY_PATH}/privoxy ]; then
43         if ! pid=$(GetPID privoxy); then
44             echo "Starting privacy enhancing proxy"
45
46             ${PRIVOXY_PATH}/privoxy --pidfile ${PRIVOXY_PIDFILE} --user ${PRIVOXY_USER} ${PRIVOXY_CONFIG} 2>&1
47         fi
48     fi
49 }
50
51 StopService ()
52 {
53     if pid=$(GetPID privoxy); then
54         echo "Stopping privacy enhancing proxy"
55         kill -TERM "${pid}"
56     else
57         echo "privoxy is not running."
58     fi
59 }
60
61 RestartService ()
62 {
63     if pid=$(GetPID privoxy); then
64         echo "Restarting privacy enhancing proxy"
65         kill -HUP "${pid}"
66     else
67         StartService
68     fi
69 }
70
71 RunService "$1"