Project

General

Profile

Download (1.49 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/bin/sh
2
#
3
# rc.gateway_alarm
4
#
5
# Copyright (c) 2015-2018 Rubicon Communications, LLC (Netgate). All rights reserved.
6
#
7
# Licensed under the Apache License, Version 2.0 (the "License");
8
# you may not use this file except in compliance with the License.
9
# You may obtain a copy of the License at
10
#
11
# http://www.apache.org/licenses/LICENSE-2.0
12
#
13
# Unless required by applicable law or agreed to in writing, software
14
# distributed under the License is distributed on an "AS IS" BASIS,
15
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
# See the License for the specific language governing permissions and
17
# limitations under the License.
18

    
19
GW="$1"
20
alarm_addr="$2"
21
alarm_flag="$3"
22
alarm_rtt="$4"
23
alarm_rttsd="$5"
24
alarm_loss="$6"
25

    
26
if [ -z "$GW" ]; then
27
	exit 1
28
fi
29

    
30
print_rtt() {
31
	usec=$1
32
	usec_to_ms=$( echo "scale=3; ${usec}/1000" | bc -l )
33
	echo "${usec_to_ms}ms"
34
}
35

    
36
echo ">>> Gateway alarm: ${GW} (Addr:${alarm_addr} Alarm:${alarm_flag} RTT:$( print_rtt ${alarm_rtt} ) RTTsd:$( print_rtt ${alarm_rttsd} ) Loss:${alarm_loss}%)" | /usr/bin/logger -p daemon.info -i -t rc.gateway_alarm
37

    
38
/usr/local/sbin/pfSctl \
39
	-c "service reload dyndns ${GW}" \
40
	-c "service reload ipsecdns" \
41
	-c "service reload openvpn ${GW}" \
42
	-c "filter reload" >/dev/null 2>&1
43

    
44
# after above signal the check_reload_status process calls the following scripts simultaneously.:
45
# - "/etc/rc.dyndns.update", "dyndns=%s"
46
# - "/etc/rc.newipsecdns"
47
# - "/etc/rc.openvpn", "interface=%s"
48
# - "/etc/rc.filter_configure_sync"
49

    
50
exit $?
(38-38/83)