Commit bfcf7150 authored by Leigh Stoller's avatar Leigh Stoller

Add a default message, pass -m - to use that instead of having to

type one.
parent 7c936c1a
#!/usr/bin/perl -w #!/usr/bin/perl -w
# #
# Copyright (c) 2000-2003, 2007 University of Utah and the Flux Group. # Copyright (c) 2000-2016 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -30,7 +30,8 @@ use Getopt::Std; ...@@ -30,7 +30,8 @@ use Getopt::Std;
# #
sub usage() sub usage()
{ {
print STDOUT "Usage: webcontrol [-m message] [-l login | nologin]\n"; print STDOUT "Usage: webcontrol [-m message | -] [-l login | nologin]\n";
print STDOUT "Specify '-' for the message, to use the default message\n";
exit(-1); exit(-1);
} }
my $optlist = "m:l:"; my $optlist = "m:l:";
...@@ -42,6 +43,8 @@ use lib "@prefix@/lib"; ...@@ -42,6 +43,8 @@ use lib "@prefix@/lib";
use libdb; use libdb;
my $TBROOT = "@prefix@"; my $TBROOT = "@prefix@";
my $DEFMESSAGE = "Testbed going offline for maintenance; ".
"back in a little while";
# Untaint the path # Untaint the path
$ENV{'PATH'} = "/usr/bin:$TBROOT/libexec:$TBROOT/sbin:$TBROOT/bin"; $ENV{'PATH'} = "/usr/bin:$TBROOT/libexec:$TBROOT/sbin:$TBROOT/bin";
...@@ -67,6 +70,9 @@ my $message = ""; ...@@ -67,6 +70,9 @@ my $message = "";
if (defined($options{"m"})) { if (defined($options{"m"})) {
$setmesg = 1; $setmesg = 1;
$message = $options{"m"}; $message = $options{"m"};
if ($message eq "-") {
$message = $DEFMESSAGE;
}
} }
my $setlogin = 0; my $setlogin = 0;
my $logins = 1; my $logins = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment