aboutsummaryrefslogtreecommitdiffstats
path: root/examples/historical/clients/ssendfile.pl
diff options
context:
space:
mode:
authorJoachim Tingvold <joachim@tingvold.com>2016-03-25 15:23:08 +0100
committerJoachim Tingvold <joachim@tingvold.com>2016-03-25 15:23:08 +0100
commit519bae0f07f38bd82257c61a924085f64ad360cc (patch)
treed249ad5957cc3698db40df972c5a60d37679abea /examples/historical/clients/ssendfile.pl
parent14dbbc1451b4d5ea99e1937020e4fc79fe7ba1a7 (diff)
Moved old, unused files.
Diffstat (limited to 'examples/historical/clients/ssendfile.pl')
-rwxr-xr-xexamples/historical/clients/ssendfile.pl50
1 files changed, 50 insertions, 0 deletions
diff --git a/examples/historical/clients/ssendfile.pl b/examples/historical/clients/ssendfile.pl
new file mode 100755
index 0000000..224f4e2
--- /dev/null
+++ b/examples/historical/clients/ssendfile.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use lib '../include';
+use POSIX;
+
+my $delaytime = 30;
+my $poll_frequency = 60;
+
+sub mylog {
+ my $msg = shift;
+ my $time = POSIX::ctime(time);
+ $time =~ s/\n.*$//;
+ printf STDERR "[%s] %s\n", $time, $msg;
+}
+
+if ($#ARGV != 1) {
+ die("Error in arguments passed\n".
+ "./ssendfile.pl addr configfile\n");
+}
+
+my $ssh = nms::switch_connect_ssh($ARGV[0]);
+my $conn = $ssh->{telnet};
+if (!defined($conn)) {
+ die("Could not connect to switch.\n");
+}
+
+open(CONFIG, $ARGV[1]);
+while (<CONFIG>) {
+ my $cmd = $_;
+ $cmd =~ s/[\r\n]+//g;
+ print "Executing: `$cmd`\n";
+# if ($cmd =~ /ip ifconfig swif0 (\d{1-3}\.\d{1-3}\.\d{1-3}\.\d{1-3})/) {
+# print "New ip: $1\n";
+# $conn->cmd( String => $cmd,
+# Timeout => 3);
+# $ssh = nms::switch_connect_ssh($1);
+# $conn = $ssh->{telnet};
+# if (!defined($conn)) {
+# die "Could not connect to new ip: $1\n";
+# }
+# }
+# else {
+ my @data = nms::switch_exec($cmd, $conn);
+ foreach my $line (@data) {
+ $line =~ s/[\r\n]+//g;
+ print "$line\n";
+ }
+# }
+}