#!/bin/bash
INTERFACE=$1
ACTION=$2

if [ "$ACTION" = "up" ]; then
    if [ -e /dev/rtc0 ]; then
        (
            for i in {1..12}; do
                if timedatectl status | grep -q "System clock synchronized: yes"; then
                    /sbin/hwclock -w
                    exit 0
                fi
                sleep 5
            done
        ) &
    fi
fi
