Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
731af9e4
Commit
731af9e4
authored
Jan 13, 2011
by
Leigh B Stoller
Browse files
Fixes to ^C. Also try much harder to detect that daemons are already
running, so that we do not start multiple times.
parent
30567392
Changes
1
Hide whitespace changes
Inline
Side-by-side
utils/testbed-control.in
View file @
731af9e4
...
...
@@ -20,6 +20,8 @@ sub usage()
my
$optlist
=
"
df
";
my
$debug
=
0
;
my
$force
=
0
;
my
$stopped
=
0
;
my
$committed
=
0
;
#
# Configure variables
...
...
@@ -84,13 +86,18 @@ DBQueryFatal("INSERT INTO sitevariables VALUES ".
sub
Restart
()
{
print
"
Starting up testbed daemons.
\n
";
system
("
$STARTUP
start
");
if
(
$?
)
{
print
"
*** Could not restart testbed daemons.
\n
";
exit
(
1
);
# Do not let the restart get interrupted. Bad.
$SIG
{
INT
}
=
'
IGNORE
';
if
(
$stopped
)
{
print
"
Starting up testbed daemons.
\n
";
system
("
$STARTUP
start
");
if
(
$?
)
{
print
"
*** Could not restart testbed daemons.
\n
";
exit
(
1
);
}
print
"
\n
";
}
print
"
\n
";
print
"
Turning on the web interface and allowing swaps
\n
";
if
(
system
("
$SETSITEVAR
general/testbed_shutdown -
")
||
...
...
@@ -102,10 +109,26 @@ sub Restart()
}
if
(
$ARGV
[
0
]
eq
"
boot
")
{
#
# What if the system is currently started? We do not want to start
# two copies of things. Look to see if stated and/or bootinfo are
# running, since these are the two most critical and quickly missed
# daemons.
#
if
(
CheckDaemonRunning
("
stated
")
||
CheckDaemonRunning
("
bootinfo
"))
{
Fatal
("
Testbed appears to be running (stated and/or bootinfo running)
");
}
Restart
();
exit
(
0
);
}
sub
Handler
()
{
Restart
();
exit
(
1
);
}
$SIG
{
INT
}
=
'
IGNORE
';
#
# Stop the testbed before doing the update.
#
...
...
@@ -129,6 +152,7 @@ if ($?) {
}
print
"
-> Waiting a few seconds for testbed to quiet down ...
\n
";
$SIG
{
INT
}
=
\
&Handler
;
sleep
(
5
);
print
"
-> Looking for experiments still in transition.
\n
";
...
...
@@ -164,6 +188,8 @@ system("$STARTUP stop >/dev/null 2>&1");
if
(
$?
)
{
Fatal
("
Could not stop testbed daemons. Stopping. Best to reboot!
");
}
$stopped
=
1
;
my
$activeimages
=
Image
->
ActiveImages
();
if
(
defined
(
$activeimages
))
{
my
@activeimages
=
@
{
$activeimages
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment