Posts Tagged ‘perl’

SSH Manager

September 25th, 2009 roger No comments

Normalmente uso o putty para ligações ssh senti a falta de algo do género para linux mas em modo texto com alguma pesquisa descobri o seguinte programa  sshmgr deixo aqui a referencia ao programa :)

SSH ManaGeR is now deprecated in favour of CONNection ManaGeR.

If you have many ssh accounts on different servers requiring different ports and user names, this is the tool for you!
This is more than _just_ a simple ssh wrapper, sshmgr is really seven applications in one!
There is sshmgr, scmdmgr, sftpmgr, scpget, scpput, ftpmgr and telnetmgr.

sshmgr depends on Perl (>= 5.6.0) and the CPAN module AppConfig. sshmgr also has an accompanying Bash (requires bash >= 2.05b) script for extending the tab auto completion for the commands sshmgr, scmdmgr, sftpmgr, ftpmgr and telnetmgr. There is now a Makefile included for all those that don’t want the hassles of the deb, rpm or tgz packages. Please don’t ask me to include password storing facilities, use ssh-agent and ssh keys to alleviate any password typing woes. Documentation on ssh-agent and ssh keys can be found here.

If you want to contribute bug-reports, feature requests, or code you can join the mailing list here or you can contact me directly.

Here’s my PGP Key.
PGP key num: 04A112AD
Fingerprint: 0864 D1CC E3E5 48BF 3B0F 4373 55EC C529 04A1 12AD

Categories: scripts, sysadmin Tags: ,

Tarefa chata + perl

August 21st, 2009 roger No comments

Tarefa abrir 80 zips e substituir um documento.

Uma vez que não gosto de tarefas rotineiras resolvi elaborar um script para isto e aqui fica.

#!/usr/bin/perl -w
use warnings;
#use strict;

use Archive::Zip qw( :ERROR_CODES );

#list directory
@files = <*.zip>;
foreach $file (@files) {
print $file . “\n”;

# Read the ZIP
my $zip = Archive::Zip->new();
unless( $zip->read($file) == AZ_OK ) {
die “read error\n”;

# Update file
$zip->removeMember( ‘Pathdentrodozip’);
$zip->addFile( ‘.Pathforadozip’, ‘Pathdentrodozip’ );

# Save the Zip file

Posso ainda melhorar mas não prevejo ter que usar novamente este script.

O que tive de ler: Modulo CPAN

E tive ajuda do Bruno Barão na interpretação do modulo que desde já agradeço

Categories: Uncategorized, scripts Tags: ,