debian
Last change
on this file since 5aace3f was
27d5cd1,
checked in by Kyle Brogle <broglek@…>, 14 years ago
|
Fixed error in postrm when purging [tried to rm a folder without -r]
Fixed bug in init where it would try to kill a pid that didn't exist
when restarted
|
-
Property mode set to
100755
|
File size:
1.8 KB
|
Line | |
---|
1 | #!/bin/bash |
---|
2 | ### BEGIN INIT INFO |
---|
3 | # Provides: gutenbach-remctl |
---|
4 | # Required-Start: $remote_fs $syslog |
---|
5 | # Required-Stop: $remote_fs $syslog |
---|
6 | # Default-Start: 2 3 4 5 |
---|
7 | # Default-Stop: 0 1 6 |
---|
8 | # Short-Description: Starts remctld. |
---|
9 | # Description: Starts remctld. |
---|
10 | ### END INIT INFO |
---|
11 | |
---|
12 | case "$1" in |
---|
13 | start) |
---|
14 | |
---|
15 | |
---|
16 | pid=$(sudo lsof -i :4373 | grep remctld | sed s/remctld\ // | sed s/\ .*//) |
---|
17 | if [ -n "$pid" ]; then |
---|
18 | kill -0 "$pid" |
---|
19 | if [ "$?" == 0 ]; then |
---|
20 | echo "Ending remctld socket binding..." >&2 |
---|
21 | kill "$pid" || true |
---|
22 | fi |
---|
23 | fi |
---|
24 | |
---|
25 | echo "Starting remctld..." >&2 |
---|
26 | remctld -m -P /var/run/gutenbach/remctld.pid & |
---|
27 | ;; |
---|
28 | |
---|
29 | stop) |
---|
30 | |
---|
31 | |
---|
32 | pid=$(sudo lsof -i :4373 | grep remctld | sed s/remctld\ // | sed s/\ .*//) |
---|
33 | if [ -n "$pid" ]; then |
---|
34 | kill -0 "$pid" |
---|
35 | if [ "$?" == 0 ]; then |
---|
36 | echo "Ending remctld socket binding..." >&2 |
---|
37 | kill "$pid" || true |
---|
38 | fi |
---|
39 | fi |
---|
40 | ;; |
---|
41 | |
---|
42 | restart) |
---|
43 | |
---|
44 | pid=$(sudo lsof -i :4373 | grep remctld | sed s/remctld\ // | sed s/\ .*//) |
---|
45 | if [ -n "$pid" ]; then |
---|
46 | kill -0 "$pid" |
---|
47 | if [ "$?" == 0 ]; then |
---|
48 | echo "Ending remctld socket binding..." >&2 |
---|
49 | kill "$pid" || true |
---|
50 | fi |
---|
51 | fi |
---|
52 | |
---|
53 | echo "Starting remctld..." >&2 |
---|
54 | remctld -m -P /var/run/gutenbach/remctld.pid & |
---|
55 | ;; |
---|
56 | |
---|
57 | force-reload) |
---|
58 | if [ -e /var/run/gutenbach/remctld.pid ]; then |
---|
59 | pid=$(cat /var/run/gutenbach/remctld.pid) |
---|
60 | if [ -n "$pid" ]; then |
---|
61 | kill -0 "$pid" |
---|
62 | if [ "$?" == 0 ]; then |
---|
63 | echo "Ending remctld..." >&2 |
---|
64 | kill "$pid" || true |
---|
65 | fi |
---|
66 | fi |
---|
67 | fi |
---|
68 | |
---|
69 | pid=$(sudo lsof -i :4373 | grep remctld | sed s/remctld\ // | sed s/\ .*//) |
---|
70 | if [ -n "$pid" ]; then |
---|
71 | kill -0 "$pid" |
---|
72 | if [ "$?" == 0 ]; then |
---|
73 | echo "Ending remctld socket binding..." >&2 |
---|
74 | kill "$pid" || true |
---|
75 | fi |
---|
76 | fi |
---|
77 | |
---|
78 | echo "Starting remctld..." >&2 |
---|
79 | remctld -m -P /var/run/gutenbach/remctld.pid & |
---|
80 | ;; |
---|
81 | |
---|
82 | *) |
---|
83 | echo "Usage: $0 {start|stop|restart}" |
---|
84 | exit 1 |
---|
85 | ;; |
---|
86 | esac |
---|
Note: See
TracBrowser
for help on using the repository browser.