]> git.proxmox.com Git - pve-installer.git/blame - checktime
sys: wait a second after sending TERM signal before going for KILL
[pve-installer.git] / checktime
CommitLineData
89a12446
DM
1#!/usr/bin/perl -w
2
3use strict;
d0817324
TL
4use warnings;
5
89a12446 6use File::stat;
d0817324 7use POSIX qw(strftime);
89a12446
DM
8
9sub testtime {
d0817324 10 my $st = stat("/usr/bin/checktime") || stat("./checktime");
89a12446
DM
11
12 my $ctime = time();
13
14 if ($ctime < $st->atime) {
d0817324
TL
15 my $system_time_str = strftime "%F %T", localtime $ctime;
16 my $pkg_time_str = strftime "%F %T", localtime $st->atime;
17 warn "detected wrong system time $system_time_str, older than installer ($pkg_time_str)\n";
89a12446
DM
18 my $tstr = localtime $st->atime;
19 # correct system time to avoid errors, i.e gpg fails
20 system ("date -s '$tstr'");
d0817324 21 }
89a12446
DM
22}
23
24testtime();
25
26exit (0);