Skip to content
GitLab
Menu
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
a6a8225d
Commit
a6a8225d
authored
Jan 27, 2001
by
Mac Newbold
Browse files
Fixed errors when a vlan has no members.
parent
09a9e87b
Changes
1
Hide whitespace changes
Inline
Side-by-side
tbsetup/savevlans.in
View file @
a6a8225d
...
...
@@ -8,8 +8,6 @@ my $TBROOT = "@prefix@";
$ENV
{'
PATH
'}
=
'
@prefix@/sbin:@prefix@/bin:/bin
';
open
(
LIST
,"
snmpit -l |
")
||
die
("
savevlans: couldn't run snmpit: $!
\n
");
my
$time
=
`
date +20%y%m%d-%H.%M.%S
`;
chomp
(
$time
);
my
$name
=
"
$TBROOT
/backup/vlans-
$time
";
...
...
@@ -22,13 +20,17 @@ use Fcntl;
sysopen
(
OUT
,
$name
,
(
O_WRONLY
|
O_EXCL
|
O_CREAT
)
)
||
die
("
savevlans: couldn't open '
$name
' for writing: $!
\n
");
open
(
LIST
,"
snmpit -l |
")
||
die
("
savevlans: couldn't run snmpit: $!
\n
");
print
OUT
"
START vlan
\n
";
while
(
<
LIST
>
)
{
chop
;
if
(
/(^ID)|(^--)|(^1 )/
)
{
next
;
}
s/[\t ]+/ /g
;
/(\d+)\s+(\S+)\s+(.*)/
;
if
(
$
2
ne
"
System
")
{
/(\d+)\s+(\S+)\s+(.*)?/
;
if
(
!
defined
$
3
)
{
next
;
}
#print "split to $1, $2, $3\n";
if
(
$
2
ne
"
default
")
{
(
my
$name
,
my
@IDs
)
=
(
$
2
,
split
("
",
$
3
));
print
OUT
"
$name
@IDs
\n
";
}
...
...
Write
Preview
Supports
Markdown
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