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
c346fd07
Commit
c346fd07
authored
Dec 10, 2014
by
Dan Reading
Browse files
Extend to backup config files from procurve switches
parent
318c2fa4
Changes
1
Hide whitespace changes
Inline
Side-by-side
utils/backupswitches.in
View file @
c346fd07
...
...
@@ -28,6 +28,8 @@ my $GRAB = "@prefix@/sbin/grabswitchconfig";
use
lib
'
@prefix@/lib
';
use
libdb
;
use
lib
'
@prefix@/lib/snmpit_test
';
use
snmpit_lib
;
use
strict
;
use
English
;
...
...
@@ -60,10 +62,23 @@ my $datestr = "$year-$mon-$mday";
#
unlink
$TMPFILE
;
foreach
my
$switch
(
@ARGV
)
{
system
"
$GRAB
$switch
$TMPFILE
"
and
die
"
Unable to grab config for
$switch
\n
";
system
"
mv
$TMPFILE
$BACKUPDIR
/
$switch
-
$datestr
\n
"
and
die
"
Unable to move config file to
$BACKUPDIR
/
$switch
-
$datestr
\n
";
#
# Is it a Cisco or maybe an HP
my
$type
=
getDeviceType
(
$switch
);
if
(
$type
!~
/cisco/
&&
$type
!~
/catalyst/
&&
$type
!~
/hp/
)
{
die
"
*** $0:
\n
"
.
"
only Cisco and Procurves supported NOT (type
$type
)
\n
";
}
if
(
$type
=~
/cisco/
||
$type
=~
/catalyst/
)
{
system
"
$GRAB
$switch
$TMPFILE
"
and
die
"
Unable to grab config for
$switch
\n
";
system
"
mv
$TMPFILE
$BACKUPDIR
/
$switch
-
$datestr
\n
"
and
die
"
Unable to move config file to
$BACKUPDIR
/
$switch
-
$datestr
\n
";
}
if
(
$type
=~
/hp/
)
{
system
"
scp
$switch
:/cfg/running-config
$BACKUPDIR
/
$switch
-
$datestr
\n
"
and
die
"
Unable to grab and save config for
$switch
\n
"
}
}
exit
0
;
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