summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Larson <mike@vyatta.com>2011-05-04 14:06:08 -0700
committerMichael Larson <mike@vyatta.com>2011-05-04 14:06:08 -0700
commit6378af737b35899c3673a435c65ddf141a8f849e (patch)
tree3c1c0f82d332d75d107df9ba9726bc0ffb166c94
parent192e1a1e2e130401ae5c69351f97711487aaa13d (diff)
downloadvyatta-op-6378af737b35899c3673a435c65ddf141a8f849e.tar.gz
vyatta-op-6378af737b35899c3673a435c65ddf141a8f849e.zip
allow "reboot at" and "reboot" to be invoked by the rest api.
-rwxr-xr-xscripts/vyatta-reboot.pl17
1 files changed, 10 insertions, 7 deletions
diff --git a/scripts/vyatta-reboot.pl b/scripts/vyatta-reboot.pl
index 4d34fee..eaef885 100755
--- a/scripts/vyatta-reboot.pl
+++ b/scripts/vyatta-reboot.pl
@@ -115,11 +115,12 @@ if ($action eq "reboot") {
if (defined $now) {
do_reboot($login);
} else {
- if (prompt("Proceed with reboot? [confirm]", -y1d=>"y")) {
+ if (defined($ENV{VYATTA_PROCESS_CLIENT} && $ENV{VYATTA_PROCESS_CLIENT} eq 'gui2_rest') ||
+ prompt("Proceed with reboot? [confirm]", -y1d=>"y")) {
do_reboot($login);
- } else {
- print "Reboot canceled\n";
- exit 1;
+ } else {
+ print "Reboot canceled\n";
+ exit 1;
}
}
}
@@ -155,9 +156,11 @@ if ($action eq "reboot_at") {
system("atrm $job");
print "\nReload scheduled for $time\n\n";
- if (! prompt("Proceed with reboot schedule? [confirm]", -y1d=>"y")) {
- print "Reboot canceled\n";
- exit 1;
+ if (!defined($ENV{VYATTA_PROCESS_CLIENT}) || $ENV{VYATTA_PROCESS_CLIENT} ne 'gui2_rest') {
+ if (! prompt("Proceed with reboot schedule? [confirm]", -y1d=>"y")) {
+ print "Reboot canceled\n";
+ exit 1;
+ }
}
@lines = `echo sudo /sbin/reboot | at $at_time 2>&1`;