#!/usr/bin/perl -w #Telnet Script to read the OWW tcp port and write the output to a file for upload to the net # # use Net::Telnet (); use Cwd; open my $fh, '>', '/home/Smitty/scripts/perl/WLStickers.txt' or die $!; { $t = new Net::Telnet (Timeout => 10, Output_log => $ofile); $t->open("127.0.0.1 8891"); $t->close; } exit 0 #### #!/usr/bin/perl -w use Net::FTP; use DBI; $dbh = DBI->connect('dbi:mysql:database','user','pass') or die "Connection Error: $DBI::errstr\n"; $sql = "select concat_ws(',' , TIME_FORMAT(NZST,'%h:%i') ,DATE_FORMAT(NZST,'%d/%m/%y'),t2,'',wdchill,rh,dp,bp,'',wdspd,ROUND(wddeg),rn,'','','','',wdgst,'c|kmh|mb|mm') FROM tbl_owwdata ORDER BY wx_idx DESC LIMIT 1"; $sth = $dbh->prepare($sql); $sth->execute or die "SQL Error: $DBI::errstr\n"; while (@row = $sth->fetchrow_array) { open (MYFILE, '>WL_stickertags.txt'); print MYFILE "@row\n"; close (MYFILE); } $ftp = Net::FTP->new("some.where.com", Debug => 0) or die "Cannot connect to Simplehost: $@"; $ftp->login("******",'*******') or die "Cannot login ", $ftp->message; $ftp->cwd("/a.b.c/folder") or die "Cannot change working directory ", $ftp->message; $ftp->put("WL_stickertags.txt") or die "put failed ", $ftp->message; $ftp->quit; exit 0