view etc/periodic/daily/800.local-ipv6-refresh @ 188:cf4097c83691

Allow enabling and disabling the daily local-ipv6-refresh script by periodic configuration variables. Also allow the configuration of the traceroute6 flags that are to be used.
author Franz Glasner <fzglas.hg@dom66.de>
date Fri, 19 Aug 2022 01:46:16 +0200
parents f9ba0fb173fb
children e292d85338b3
line wrap: on
line source

#!/bin/sh
#
# @(#)@@PKGORIGIN@@ $HGid$
#
# Daily script to keep the IPv6 routing working
#

# If there is a global system configuration file, suck it in.
if [ -r /etc/defaults/periodic.conf ]
then
    . /etc/defaults/periodic.conf
    source_periodic_confs
fi

#
# Source in RC configurations also because we need the value of the
# IPv6 default router (if any).
#
if [ -r /etc/defaults/rc.conf ]
then
    . /etc/defaults/rc.conf
    source_rc_confs
fi

#
# Default configuration variables
#
: ${daily_local_ipv6_refresh_enable:="NO"}
: ${daily_local_ipv6_refresh_flags:="-n -w2 -q2 -m1 -I"}

rc=0

# Go on only if this script is enabled in the configuration
case "${daily_local_ipv6_refresh_enable}" in
[Yy][Ee][Ss])
    ;;
[Nn][Oo])
    exit 0
    ;;
*)
    echo 1>&2 "$0: WARNING: \$daily_local_ipv6_refresh_enable is not set properly - assuming \"NO\" has been set"
    exit 0
    ;;
esac  

case "${ipv6_defaultrouter}" in
[Nn][Oo])
    # SKIP because no IP static IPv6 router given
    ;;
*)
    if type anticongestion >/dev/null 2>&1; then
        anticongestion_sleeptime=60
        anticongestion
    fi
    /usr/sbin/traceroute6 ${daily_local_ipv6_refresh_flags} "${ipv6_defaultrouter}"
    rc=$?
    ;;
esac

exit $rc