1 | 1 | simandl | #!/bin/bash |
2 | | | |
3 | | | FLAGS="defaults 95" |
4 | | | |
5 | | | function start_rates() |
6 | | | { |
7 | | | nohup /opt/statistiky/collect_rates.sh &>/dev/null & |
8 | | | echo $! >/var/run/collect_rates.sh.pid |
9 | | | } |
10 | | | |
11 | | | function start_arp() |
12 | | | { |
13 | | | nohup /opt/statistiky/collect_arp.sh &>/dev/null & |
14 | | | echo $! >/var/run/collect_arp.sh.pid |
15 | | | } |
16 | | | |
17 | | | function start_ping() |
18 | | | { |
19 | | | nohup /opt/statistiky/collect_ping.sh &>/dev/null & |
20 | | | echo $! >/var/run/collect_ping.sh.pid |
21 | | | } |
22 | | | function start_crusader() |
23 | | | { |
24 | | | nohup /opt/statistiky/collect_crusader.sh &>/dev/null & |
25 | | | echo $! >/var/run/collect_crusader.sh.pid |
26 | | | } |
27 | | | function start_system() |
28 | | | { |
29 | | | nohup /opt/statistiky/collect_system_info.sh &>/dev/null & |
30 | | | echo $! >/var/run/collect_system_info.sh.pid |
31 | | | } |
32 | | | function start_temp() |
33 | | | { |
34 | | | nohup /opt/statistiky/collect_temp.sh &>/dev/null & |
35 | | | echo $! >/var/run/collect_temp.sh.pid |
36 | | | } |
37 | | | |
38 | | | function stop_rates() |
39 | | | { |
40 | | | kill `cat /var/run/collect_rates.sh.pid` |
41 | | | rm -f /var/run/collect_rates.sh.pid |
42 | | | } |
43 | | | function stop_arp() |
44 | | | { |
45 | | | kill `cat /var/run/collect_arp.sh.pid` |
46 | | | rm -f /var/run/collect_arp.sh.pid |
47 | | | } |
48 | | | function stop_ping() |
49 | | | { |
50 | | | kill `cat /var/run/collect_ping.sh.pid` |
51 | | | rm -f /var/run/collect_ping.sh.pid |
52 | | | } |
53 | | | function stop_crusader() |
54 | | | { |
55 | | | kill `cat /var/run/collect_crusader.sh.pid` |
56 | | | rm -f /var/run/collect_crusader.sh.pid |
57 | | | } |
58 | | | function stop_system() |
59 | | | { |
60 | | | kill `cat /var/run/collect_system_info.sh.pid` |
61 | | | rm -f /var/run/collect_system_info.sh.pid |
62 | | | } |
63 | | | function stop_temp() |
64 | | | { |
65 | | | kill `cat /var/run/collect_temp.sh.pid` |
66 | | | rm -f /var/run/collect_temp.sh.pid |
67 | | | } |
68 | | | |
69 | | | case "$1" in |
70 | | | start) |
71 | | | shift |
72 | | | if [ $# -eq 0 ]; then |
73 | | | start_rates |
74 | | | # start_arp |
75 | | | start_ping |
76 | | | # start_crusader |
77 | | | # start_system |
78 | | | # start_temp |
79 | | | else |
80 | | | case "$1" in |
81 | | | rates) |
82 | | | start_rates |
83 | | | ;; |
84 | | | arp) |
85 | | | start_arp |
86 | | | ;; |
87 | | | ping) |
88 | | | start_ping |
89 | | | ;; |
90 | | | crusader) |
91 | | | start_crusader |
92 | | | ;; |
93 | | | system) |
94 | | | start_system |
95 | | | ;; |
96 | | | temp) |
97 | | | start_temp |
98 | | | ;; |
99 | | | test) |
100 | | | echo "start test" |
101 | | | esac |
102 | | | fi |
103 | | | ;; |
104 | | | stop) |
105 | | | shift |
106 | | | if [ $# -eq 0 ]; then |
107 | | | stop_rates |
108 | | | # stop_arp |
109 | | | stop_ping |
110 | | | # stop_crusader |
111 | | | # stop_system |
112 | | | # stop_temp |
113 | | | else |
114 | | | case "$1" in |
115 | | | rates) |
116 | | | stop_rates |
117 | | | ;; |
118 | | | arp) |
119 | | | stop_arp |
120 | | | ;; |
121 | | | ping) |
122 | | | stop_ping |
123 | | | ;; |
124 | | | crusader) |
125 | | | stop_crusader |
126 | | | ;; |
127 | | | system) |
128 | | | stop_system |
129 | | | ;; |
130 | | | temp) |
131 | | | stop_temp |
132 | | | ;; |
133 | | | test) |
134 | | | echo "stop test" |
135 | | | esac |
136 | | | fi |
137 | | | |
138 | | | ;; |
139 | | | start_rates) |
140 | | | start_rates |
141 | | | ;; |
142 | | | start_crusader) |
143 | | | start_crusader |
144 | | | ;; |
145 | | | stop_crusader) |
146 | | | stop_crusader |
147 | | | ;; |
148 | | | *) |
149 | | | echo "Usage: /etc/init.d/statistiky start | stop" |
150 | | | exit 1; |
151 | | | esac |