summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorhagbard <vyosdev@derith.de>2018-10-09 16:10:28 -0700
committerhagbard <vyosdev@derith.de>2018-10-09 16:10:28 -0700
commitb1a970c5a37f826991b0d44023dba0c7fd064dcd (patch)
treec43f97eb78b317a4aae31c6764099aa524b664f8 /scripts
parentce0714be92aa5ff297906a52303ca4085c3da81e (diff)
downloadvyatta-op-b1a970c5a37f826991b0d44023dba0c7fd064dcd.tar.gz
vyatta-op-b1a970c5a37f826991b0d44023dba0c7fd064dcd.zip
T870: Commit-confirm restarts the server even after commit
- bugfix: show reboot shows now systemd scheduled and commit-confirm scheduled reboots.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-reboot.pl50
1 files changed, 41 insertions, 9 deletions
diff --git a/scripts/vyatta-reboot.pl b/scripts/vyatta-reboot.pl
index 860e3da..93cda4f 100755
--- a/scripts/vyatta-reboot.pl
+++ b/scripts/vyatta-reboot.pl
@@ -33,7 +33,7 @@ use strict;
use warnings;
my $reboot_job_file = '/var/run/reboot.job';
-
+my $confirm_job_file = '/var/run/confirm.job';
sub parse_at_output {
my @lines = @_;
@@ -49,18 +49,50 @@ sub parse_at_output {
}
sub is_reboot_pending {
-
- if ( ! -f $reboot_job_file) {
- return (0, '');
- }
+ ### that won't exist anymore but may be called somewhere else
+ if ( -f $reboot_job_file )
+ {
my $job = `cat $reboot_job_file`;
chomp $job;
my $line = `atq $job`;
- if ($line =~ /\d+\s+(.*)\sa root$/) {
- return (1, $1);
- } else {
- return (0, '');
+ if ($line =~ /\d+\s+(.*)\sa root$/)
+ {
+ return (1, $1);
+ }
+ else
+ {
+ return (0, '');
+ }
+ }
+
+ #### comit-confirm creates an at job as well
+ if ( -f $confirm_job_file)
+ {
+ my $job = `cat $confirm_job_file`;
+ chomp $job;
+ my $line = `atq $job`;
+ if ($line =~ /\d+\s+(.*)\sa root$/)
+ {
+ return (1, $1);
+ }
+ else
+ {
+ return (0, '');
+ }
+ }
+ #### an now the systemd job from powrctrl.py
+ my $line = `systemctl status systemd-shutdownd.service`;
+ if ($line =~ /Active: active/)
+ {
+ if($line =~ m/Status:(.*)/)
+ {
+ return (1, $1);
}
+ }
+ else
+ {
+ return (0, '');
+ }
}
sub do_reboot {