Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Elijah Grubb
emulab-devel
Commits
1a2c8433
Commit
1a2c8433
authored
Jul 09, 2018
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A few tweaks for running as root; call portstats as elabman wap.
parent
b0f453df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
utils/cnetwatch.in
utils/cnetwatch.in
+6
-12
No files found.
utils/cnetwatch.in
View file @
1a2c8433
...
...
@@ -124,6 +124,8 @@ sub fatal($);
$|
=
1
;
my
$portstats
=
"
$TB
/bin/portstats
";
my
$wap
=
"
$TB
/sbin/withadminprivs
";
my
$sudo
=
"
/usr/local/bin/sudo
";
my
@nodes
=
();
my
%switches
=
();
my
%pcs
=
();
...
...
@@ -144,6 +146,7 @@ $ENV{'WITH_TB_ADMIN_PRIVS'} = 1;
# Load the Testbed support stuff.
use
lib
"
@prefix
@/lib
";
use
EmulabConstants
;
use
libdb
;
use
libtestbed
;
use
Experiment
;
...
...
@@ -190,7 +193,7 @@ if (TBGetSiteVar($svar, \$tmp)) {
exit
(
0
);
}
}
my
$svar
=
"
cnetwatch/check_interval
";
$svar
=
"
cnetwatch/check_interval
";
if
(
TBGetSiteVar
(
$svar
,
\
$tmp
))
{
if
(
$tmp
==
0
||
$tmp
>=
10
)
{
$interval
=
$tmp
;
...
...
@@ -326,16 +329,6 @@ if ($MAIL_IV == 0) {
$MAIL_IV
=
$alertinterval
;
}
#
# Check user id.
#
if
(
$UID
==
0
)
{
fatal
("
Do not run as root or portstats will fail!
");
}
if
(
!
TBAdmin
())
{
fatal
("
Must run as an admin user or portstats will fail!
");
}
# Go to ground.
if
(
!
(
$debug
||
$runonce
))
{
if
(
CheckDaemonRunning
("
cnetwatch
"))
{
...
...
@@ -824,7 +817,8 @@ sub gather($)
my
$slist
=
join
('
',
@
{
$switches
{
$switch
}});
print
STDERR
"
$switch
: invoking '
$portstats
-i -H -r -l -c -p
$slist
':
\n
"
if
(
$debug
>
1
);
if
(
!
open
(
PS
,
"
$portstats
-i -H -r -l -c -p
$slist
2>&1 |
"))
{
if
(
!
open
(
PS
,
"
$sudo
-u
"
.
PROTOUSER
()
.
"
$wap
"
.
"
$portstats
-i -H -r -l -c -p
$slist
2>&1 |
"))
{
print
STDERR
"
***
$switch
: portstats failed on open, ignored
\n
";
next
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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