aboutsummaryrefslogtreecommitdiff
path: root/contrib/polipo/Polipo
blob: 14589c84db0835224f44424e490d5e3ed795354d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh

##
# Polipo
##

. /etc/rc.common

StartService ()
{
    if [ -f /Library/Polipo/bin/polipo ]; then
        if pid=$(GetPID polipo); then
            return 0
	else if [ "${POLIPO:=-NO-}" = "-YES-" ]; then
	ConsoleMessage "Starting Polipo"
    	/Library/Polipo/bin/polipo -c /Library/Polipo/www/config
	     fi
     	fi
    fi
}

StopService ()
{
    if pid=$(GetPID polipo); then
        ConsoleMessage "Stopping Polipo"
        kill -TERM "${pid}"
    else
        ConsoleMessage "Polipo not responding."
# Just for sanity (sometimes necessary.)
        killall tor 2>/dev/null
    fi
}

RestartService ()
{
  StopService
  StartService
}

RunService "$1"