Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
annotate etc/periodic/daily/800.local-ipv6-refresh @ 351:9d6b19f72ee5
Do not use the pre-defined anticongestion but a short random sleep
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Wed, 07 Dec 2022 17:13:23 +0100 |
| parents | 738fe7206eab |
| children | 619a32c6baaa |
| rev | line source |
|---|---|
|
186
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
1 #!/bin/sh |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
2 # |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
3 # @(#)@@PKGORIGIN@@ $HGid$ |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
4 # |
|
187
f9ba0fb173fb
Some comment the new periodic script
Franz Glasner <fzglas.hg@dom66.de>
parents:
186
diff
changeset
|
5 # Daily script to keep the IPv6 routing working |
|
f9ba0fb173fb
Some comment the new periodic script
Franz Glasner <fzglas.hg@dom66.de>
parents:
186
diff
changeset
|
6 # |
|
186
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
7 |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
8 # If there is a global system configuration file, suck it in. |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
9 if [ -r /etc/defaults/periodic.conf ] |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
10 then |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
11 . /etc/defaults/periodic.conf |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
12 source_periodic_confs |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
13 fi |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
14 |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
15 # |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
16 # Source in RC configurations also because we need the value of the |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
17 # IPv6 default router (if any). |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
18 # |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
19 if [ -r /etc/defaults/rc.conf ] |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
20 then |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
21 . /etc/defaults/rc.conf |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
22 source_rc_confs |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
23 fi |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
24 |
|
188
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
25 # |
|
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
26 # Default configuration variables |
|
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
27 # |
|
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
28 : ${daily_local_ipv6_refresh_enable:="NO"} |
|
350
738fe7206eab
FIX: Allow emptying of the IPv6 refresh flags
Franz Glasner <hg@dom66.de>
parents:
215
diff
changeset
|
29 : ${daily_local_ipv6_refresh_flags="-n -w2 -q2 -m1 -I"} |
|
215
7d07c4e214ee
Allow to customize the traceroute target for the IPv6 refresh periodic task
Franz Glasner <fzglas.hg@dom66.de>
parents:
189
diff
changeset
|
30 : ${daily_local_ipv6_refresh_target:="${ipv6_defaultrouter}"} |
|
188
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
31 |
|
186
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
32 rc=0 |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
33 |
|
188
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
34 # Go on only if this script is enabled in the configuration |
|
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
35 case "${daily_local_ipv6_refresh_enable}" in |
|
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
36 [Yy][Ee][Ss]) |
|
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
37 ;; |
|
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
38 [Nn][Oo]) |
|
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
39 exit 0 |
|
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
40 ;; |
|
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
41 *) |
|
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
42 echo 1>&2 "$0: WARNING: \$daily_local_ipv6_refresh_enable is not set properly - assuming \"NO\" has been set" |
|
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
43 exit 0 |
|
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
44 ;; |
|
189
e292d85338b3
Handle empty $ipv6_defaultrouter values more explicitely
Franz Glasner <fzglas.hg@dom66.de>
parents:
188
diff
changeset
|
45 esac |
|
188
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
46 |
|
215
7d07c4e214ee
Allow to customize the traceroute target for the IPv6 refresh periodic task
Franz Glasner <fzglas.hg@dom66.de>
parents:
189
diff
changeset
|
47 case "${daily_local_ipv6_refresh_target}" in |
|
7d07c4e214ee
Allow to customize the traceroute target for the IPv6 refresh periodic task
Franz Glasner <fzglas.hg@dom66.de>
parents:
189
diff
changeset
|
48 "NO") |
|
7d07c4e214ee
Allow to customize the traceroute target for the IPv6 refresh periodic task
Franz Glasner <fzglas.hg@dom66.de>
parents:
189
diff
changeset
|
49 # SKIP because no target or no static IPv6 router given |
|
7d07c4e214ee
Allow to customize the traceroute target for the IPv6 refresh periodic task
Franz Glasner <fzglas.hg@dom66.de>
parents:
189
diff
changeset
|
50 echo 1>&2 "$0: WARNING: \$daily_local_ipv6_refresh_target is \`NO'" |
|
186
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
51 ;; |
|
189
e292d85338b3
Handle empty $ipv6_defaultrouter values more explicitely
Franz Glasner <fzglas.hg@dom66.de>
parents:
188
diff
changeset
|
52 '') |
|
e292d85338b3
Handle empty $ipv6_defaultrouter values more explicitely
Franz Glasner <fzglas.hg@dom66.de>
parents:
188
diff
changeset
|
53 # SKIP because this is an unresolvable router specification |
|
e292d85338b3
Handle empty $ipv6_defaultrouter values more explicitely
Franz Glasner <fzglas.hg@dom66.de>
parents:
188
diff
changeset
|
54 echo 1>&2 "$0: WARNING: \$ipv6_defaultrouter has an unexpected empty value" |
|
e292d85338b3
Handle empty $ipv6_defaultrouter values more explicitely
Franz Glasner <fzglas.hg@dom66.de>
parents:
188
diff
changeset
|
55 ;; |
|
188
cf4097c83691
Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables.
Franz Glasner <fzglas.hg@dom66.de>
parents:
187
diff
changeset
|
56 *) |
|
351
9d6b19f72ee5
Do not use the pre-defined anticongestion but a short random sleep
Franz Glasner <hg@dom66.de>
parents:
350
diff
changeset
|
57 #if type anticongestion >/dev/null 2>&1; then |
|
9d6b19f72ee5
Do not use the pre-defined anticongestion but a short random sleep
Franz Glasner <hg@dom66.de>
parents:
350
diff
changeset
|
58 # anticongestion_sleeptime=60 |
|
9d6b19f72ee5
Do not use the pre-defined anticongestion but a short random sleep
Franz Glasner <hg@dom66.de>
parents:
350
diff
changeset
|
59 # anticongestion |
|
9d6b19f72ee5
Do not use the pre-defined anticongestion but a short random sleep
Franz Glasner <hg@dom66.de>
parents:
350
diff
changeset
|
60 #fi |
|
9d6b19f72ee5
Do not use the pre-defined anticongestion but a short random sleep
Franz Glasner <hg@dom66.de>
parents:
350
diff
changeset
|
61 |
|
9d6b19f72ee5
Do not use the pre-defined anticongestion but a short random sleep
Franz Glasner <hg@dom66.de>
parents:
350
diff
changeset
|
62 # Wait up to 10 seconds to avoid router congestion |
|
9d6b19f72ee5
Do not use the pre-defined anticongestion but a short random sleep
Franz Glasner <hg@dom66.de>
parents:
350
diff
changeset
|
63 /bin/sleep $(/usr/bin/jot -r 1 0 10) |
|
215
7d07c4e214ee
Allow to customize the traceroute target for the IPv6 refresh periodic task
Franz Glasner <fzglas.hg@dom66.de>
parents:
189
diff
changeset
|
64 /usr/sbin/traceroute6 ${daily_local_ipv6_refresh_flags} "${daily_local_ipv6_refresh_target}" |
|
186
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
65 rc=$? |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
66 ;; |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
67 esac |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
68 |
|
39e5b947a28e
Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
69 exit $rc |
