mirror of https://github.com/aredn/aredn.git
feature: Allow supporttool to be run from shell
Allows the supporttool to generate support files when run from the shell for times that it may be required when the web interface is offline. Change-Id: I696289ea10c2e5b57f3e93d81ec7004469c4bba0
This commit is contained in:
parent
1e08847db0
commit
e5ff9ebdfb
|
@ -144,11 +144,26 @@ chomp($tstamp);
|
|||
open(my $SDFH, '<', "/tmp/supportdata.tgz") or exit(1);
|
||||
binmode $SDFH;
|
||||
|
||||
print "Content-type: application/x-gzip\r\n";
|
||||
print "Content-Disposition: attachment; filename=supportdata-$nodename-$tstamp.tgz\r\n";
|
||||
print "\r\n";
|
||||
if (exists $ENV{GATEWAY_INTERFACE}) {
|
||||
print "Content-type: application/x-gzip\r\n";
|
||||
print "Content-Disposition: attachment; filename=supportdata-$nodename-$tstamp.tgz\r\n";
|
||||
print "\r\n";
|
||||
|
||||
print while <$SDFH>;
|
||||
undef ($SDFH);
|
||||
print while <$SDFH>;
|
||||
undef ($SDFH);
|
||||
|
||||
unlink("/tmp/supportdata.tgz");
|
||||
unlink("/tmp/supportdata.tgz");
|
||||
|
||||
} else {
|
||||
undef ($SDFH);
|
||||
unlink ("/tmp/supportdata-$nodename-$tstamp.tgz"); # Shouldn't exist but lets be sure
|
||||
system ("mv", "/tmp/supportdata.tgz", "/tmp/supportdata-$nodename-$tstamp.tgz");
|
||||
if ($? != 0) {
|
||||
print "Failed to rename the support data file.\n It may be present at /tmp/supportdata.tgz\n";
|
||||
exit(1);
|
||||
} else {
|
||||
print "File created: /tmp/supportdata-$nodename-$tstamp.tgz\n";
|
||||
print "Please copy this file and remove from the node\n";
|
||||
print "to free up resources.\n"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue