-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathrc.httpry
80 lines (71 loc) · 1.98 KB
/
rc.httpry
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
#
# ----------------------------------------------------
# httpry - HTTP logging and information retrieval tool
# ----------------------------------------------------
#
# Copyright (c) 2005-2014 Jason Bittel <[email protected]>
#
#
# Start/stop/restart httpry as a daemon process. This script
# was written for use under Slackware Linux, but should be
# easily modifiable for a different system.
#
# You will need to add an output file here for httpry to write
# to while in daemon mode. If there are any additional arguments
# that need to be passed to httpry, add them to httpry_args.
#
output_file="httpry.log"
httpry_args=""
httpry_start() {
if [ ! -n "${output_file}" ] ; then
echo "Error: No output file provided; edit ${0} accordingly"
exit 1
fi
echo "Starting httpry using output file '${output_file}'..."
if [ -r "/var/run/httpry.pid" ] ; then
if [ ps acx | grep -q httpry ] ; then
echo "Error: httpry already running with PID `cat /var/run/httpry.pid`"
exit 1
else
rm -f /var/run/httpry.pid
fi
fi
eval httpry -d -o ${output_file} ${httpry_args}
}
httpry_stop() {
echo "Stopping httpry..."
if [ -r "/var/run/httpry.pid" ] ; then
kill `cat /var/run/httpry.pid`
rm -f /var/run/httpry.pid
else
killall httpry
fi
}
httpry_reload() {
echo "Reloading httpry..."
if [ -r "/var/run/httpry.pid" ] ; then
kill -HUP `cat /var/run/httpry.pid`
else
killall -HUP httpry
fi
}
case ${1} in
start)
httpry_start
;;
stop)
httpry_stop
;;
restart)
httpry_stop
sleep 1
httpry_start
;;
reload)
httpry_reload
;;
*)
echo "Usage: ${0} [start|stop|restart|reload]"
;;
esac