annotate etc/periodic/daily/800.local-ipv6-refresh @ 386:84d2735fe7f6

Simplified version tagging a lot: it is also faster now. While being there: adjusting copyright year to end in 2023 now.
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 23 Feb 2023 01:08:31 +0100
parents d71f9efac6a8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 #
386
84d2735fe7f6 Simplified version tagging a lot: it is also faster now.
Franz Glasner <fzglas.hg@dom66.de>
parents: 353
diff changeset
3 # @(#)@@SIMPLEVERSIONTAG@@
186
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 #
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
16 # 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
17 #
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
18 : ${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
19 : ${daily_local_ipv6_refresh_flags="-n -w2 -q2 -m1 -I"}
353
d71f9efac6a8 Enhance 800.local-ipv6-refresh: no need to include "rc.conf" and friends directly: use sysrc instead.
Franz Glasner <fzglas.hg@dom66.de>
parents: 352
diff changeset
20 : ${daily_local_ipv6_refresh_target=""}
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
21
186
39e5b947a28e Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
22 rc=0
39e5b947a28e Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
23
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
24 # 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
25 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
26 [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
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 [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
29 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
30 ;;
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 *)
352
619a32c6baaa Redirections for "echo" at the end
Franz Glasner <fzglas.hg@dom66.de>
parents: 351
diff changeset
32 echo "$0: WARNING: \$daily_local_ipv6_refresh_enable is not set properly - assuming \"NO\" has been set" 1>&2
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
33 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
34 ;;
189
e292d85338b3 Handle empty $ipv6_defaultrouter values more explicitely
Franz Glasner <fzglas.hg@dom66.de>
parents: 188
diff changeset
35 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
36
353
d71f9efac6a8 Enhance 800.local-ipv6-refresh: no need to include "rc.conf" and friends directly: use sysrc instead.
Franz Glasner <fzglas.hg@dom66.de>
parents: 352
diff changeset
37 if [ -z "${daily_local_ipv6_refresh_target}" ]; then
d71f9efac6a8 Enhance 800.local-ipv6-refresh: no need to include "rc.conf" and friends directly: use sysrc instead.
Franz Glasner <fzglas.hg@dom66.de>
parents: 352
diff changeset
38 daily_local_ipv6_refresh_target="$(/usr/sbin/sysrc -i -n ipv6_defaultrouter)"
d71f9efac6a8 Enhance 800.local-ipv6-refresh: no need to include "rc.conf" and friends directly: use sysrc instead.
Franz Glasner <fzglas.hg@dom66.de>
parents: 352
diff changeset
39 fi
d71f9efac6a8 Enhance 800.local-ipv6-refresh: no need to include "rc.conf" and friends directly: use sysrc instead.
Franz Glasner <fzglas.hg@dom66.de>
parents: 352
diff changeset
40
215
7d07c4e214ee Allow to customize the traceroute target for the IPv6 refresh periodic task
Franz Glasner <fzglas.hg@dom66.de>
parents: 189
diff changeset
41 case "${daily_local_ipv6_refresh_target}" in
353
d71f9efac6a8 Enhance 800.local-ipv6-refresh: no need to include "rc.conf" and friends directly: use sysrc instead.
Franz Glasner <fzglas.hg@dom66.de>
parents: 352
diff changeset
42 [Nn][Oo])
215
7d07c4e214ee Allow to customize the traceroute target for the IPv6 refresh periodic task
Franz Glasner <fzglas.hg@dom66.de>
parents: 189
diff changeset
43 # SKIP because no target or no static IPv6 router given
352
619a32c6baaa Redirections for "echo" at the end
Franz Glasner <fzglas.hg@dom66.de>
parents: 351
diff changeset
44 echo "$0: WARNING: \$daily_local_ipv6_refresh_target is \`NO'" 1>&2
186
39e5b947a28e Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
45 ;;
189
e292d85338b3 Handle empty $ipv6_defaultrouter values more explicitely
Franz Glasner <fzglas.hg@dom66.de>
parents: 188
diff changeset
46 '')
e292d85338b3 Handle empty $ipv6_defaultrouter values more explicitely
Franz Glasner <fzglas.hg@dom66.de>
parents: 188
diff changeset
47 # SKIP because this is an unresolvable router specification
352
619a32c6baaa Redirections for "echo" at the end
Franz Glasner <fzglas.hg@dom66.de>
parents: 351
diff changeset
48 echo "$0: WARNING: \$ipv6_defaultrouter has an unexpected empty value" 1>&2
189
e292d85338b3 Handle empty $ipv6_defaultrouter values more explicitely
Franz Glasner <fzglas.hg@dom66.de>
parents: 188
diff changeset
49 ;;
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
50 *)
351
9d6b19f72ee5 Do not use the pre-defined anticongestion but a short random sleep
Franz Glasner <hg@dom66.de>
parents: 350
diff changeset
51 #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
52 # 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
53 # anticongestion
9d6b19f72ee5 Do not use the pre-defined anticongestion but a short random sleep
Franz Glasner <hg@dom66.de>
parents: 350
diff changeset
54 #fi
9d6b19f72ee5 Do not use the pre-defined anticongestion but a short random sleep
Franz Glasner <hg@dom66.de>
parents: 350
diff changeset
55
9d6b19f72ee5 Do not use the pre-defined anticongestion but a short random sleep
Franz Glasner <hg@dom66.de>
parents: 350
diff changeset
56 # 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
57 /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
58 /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
59 rc=$?
39e5b947a28e Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
60 ;;
39e5b947a28e Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
61 esac
39e5b947a28e Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
62
39e5b947a28e Create a periodic script to keep the IPv6 routing working.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
63 exit $rc