#!/usr/bin/env perl
use strict;
use warnings;

use MYDan::Util::OptConf;
use MYDan::Util::NTPSync;

=head1 SYNOPSIS

 $0 [--daemon]
    [--interval number]

=cut


my $option = MYDan::Util::OptConf->load();
my %o = $option->set( try => 3, interval => 3600 )
    ->get(qw( daemon interval=i try=i  ))->dump();

$0 = 'mydan.ntpsync';

if( $o{daemon} )
{
    open(STDOUT, '>>/var/log/ntpsync.log') || die "STDOUT ERROR $!";
    open(STDERR, '>>/var/log/ntpsync.log') || die "STDERR ERROR $!";
    exit 0 if fork;
}

MYDan::Util::NTPSync->new(%o)->run();
