1 |
7a012bff
|
Renato Botelho
|
#!/bin/sh
|
2 |
|
|
#
|
3 |
|
|
# rc.gateway_alarm
|
4 |
|
|
#
|
5 |
e3c0d75e
|
Luiz Souza
|
# Copyright (c) 2015-2018 Rubicon Communications, LLC (Netgate). All rights reserved.
|
6 |
7a012bff
|
Renato Botelho
|
#
|
7 |
|
|
# Redistribution and use in source and binary forms, with or without
|
8 |
|
|
# modification, are permitted provided that the following conditions are met:
|
9 |
|
|
#
|
10 |
|
|
# 1. Redistributions of source code must retain the above copyright notice,
|
11 |
|
|
# this list of conditions and the following disclaimer.
|
12 |
|
|
#
|
13 |
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
14 |
|
|
# notice, this list of conditions and the following disclaimer in
|
15 |
|
|
# the documentation and/or other materials provided with the
|
16 |
|
|
# distribution.
|
17 |
|
|
#
|
18 |
|
|
# 3. All advertising materials mentioning features or use of this software
|
19 |
|
|
# must display the following acknowledgment:
|
20 |
|
|
# "This product includes software developed by the pfSense Project
|
21 |
|
|
# for use in the pfSense® software distribution. (http://www.pfsense.org/).
|
22 |
|
|
#
|
23 |
|
|
# 4. The names "pfSense" and "pfSense Project" must not be used to
|
24 |
|
|
# endorse or promote products derived from this software without
|
25 |
|
|
# prior written permission. For written permission, please contact
|
26 |
|
|
# coreteam@pfsense.org.
|
27 |
|
|
#
|
28 |
|
|
# 5. Products derived from this software may not be called "pfSense"
|
29 |
|
|
# nor may "pfSense" appear in their names without prior written
|
30 |
|
|
# permission of the Electric Sheep Fencing, LLC.
|
31 |
|
|
#
|
32 |
|
|
# 6. Redistributions of any form whatsoever must retain the following
|
33 |
|
|
# acknowledgment:
|
34 |
|
|
#
|
35 |
|
|
# "This product includes software developed by the pfSense Project
|
36 |
|
|
# for use in the pfSense software distribution (http://www.pfsense.org/).
|
37 |
|
|
#
|
38 |
|
|
# THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
39 |
|
|
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
40 |
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
41 |
|
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
42 |
|
|
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
43 |
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
44 |
|
|
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
45 |
|
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
46 |
|
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
47 |
|
|
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
48 |
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
49 |
|
|
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
50 |
|
|
|
51 |
|
|
GW="$1"
|
52 |
f4c3483a
|
PiBa-NL
|
alarm_addr="$2"
|
53 |
|
|
alarm_flag="$3"
|
54 |
|
|
alarm_rtt="$4"
|
55 |
|
|
alarm_rttsd="$5"
|
56 |
|
|
alarm_loss="$6"
|
57 |
7a012bff
|
Renato Botelho
|
|
58 |
|
|
if [ -z "$GW" ]; then
|
59 |
|
|
exit 1
|
60 |
|
|
fi
|
61 |
|
|
|
62 |
f4c3483a
|
PiBa-NL
|
echo ">>> Gateway alarm: ${GW} (Addr:${alarm_addr} Alarm:${alarm_flag} RTT:${alarm_rtt}ms RTTsd:${alarm_rttsd}ms Loss:${alarm_loss}%)" | /usr/bin/logger -p daemon.info -i -t rc.gateway_alarm
|
63 |
|
|
|
64 |
7a012bff
|
Renato Botelho
|
/usr/local/sbin/pfSctl \
|
65 |
|
|
-c "service reload dyndns ${GW}" \
|
66 |
|
|
-c "service reload ipsecdns" \
|
67 |
|
|
-c "service reload openvpn ${GW}" \
|
68 |
|
|
-c "filter reload" >/dev/null 2>&1
|
69 |
|
|
|
70 |
f4c3483a
|
PiBa-NL
|
# after above signal the check_reload_status process calls the following scripts simultaneously.:
|
71 |
|
|
# - "/etc/rc.dyndns.update", "dyndns=%s"
|
72 |
|
|
# - "/etc/rc.newipsecdns"
|
73 |
|
|
# - "/etc/rc.openvpn", "interface=%s"
|
74 |
|
|
# - "/etc/rc.filter_configure_sync"
|
75 |
|
|
|
76 |
7a012bff
|
Renato Botelho
|
exit $?
|