#!/bin/sh

##########################################################################
#   Title:
#       Optional, defaults to the name of the script sans extention
#
#   Section:
#       8
#
#   Synopsis:
#       
#   Description:
#       Correct a clock that has strayed too far for NTP to deal with
#       
#   Arguments:
#       
#   Returns:
#
#   Examples:
#
#   Files:
#
#   Environment:
#
#   See also:
#       
#   History:
#   Date        Name        Modification
#   2020-12-23  Jason Bacon Begin
#   2024-11-12  Jason Bacon Add man page template and usage
##########################################################################

usage()
{
    printf "Usage: $0\n"
    exit 1
}


##########################################################################
#   Main
##########################################################################

if [ $# != 0 ]; then
    usage
fi

case $(auto-ostype) in
DragonFly|FreeBSD|NetBSD)
    # Use absolute pathnames with su to avoid malicious programs
    printf "Root "
    su -m root -c '/usr/sbin/service ntpd stop; /usr/sbin/ntpdate -u pool.ntp.org; /usr/sbin/service ntpd start'
    ;;

*)
    # To-do: auto-detect chronyd or ntp on RHEL
    auto-unsupported-os $0
    exit 1
    ;;

esac
