![]() |
|< 1 2 3 >| | ![]() |
23 Einträge, 3 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my ($user,$pass,$db,$host) = ("username","passwort","datenbank","host");
my $dbh = DBI->connect("DBI:mysql:$db:$host",$user,$pass) or die $DBI::errstr;
my $stmt = "SELECT domain,SUM(mails),SUM(spam),SUM(spam_quaran),SUM(virus) FROM tabellenname GROUP BY domain";
my $sth = $dbh->prepare($stmt) or die $dbh->errstr();
$sth->execute() or die $dbh->errstr();
while(my ($dom,$mails,$spam,$spam2,$virus) = $sth->fetchrow_array()){
print qq~
Domain: $dom
Mails: $mails
Spam: $spam
Spam2: $spam2
Virus: $virus
~;
}
$sth->finish();
$dbh->disconnect();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl
use strict;
use warnings;
use Net::SSH::Perl;
my ($host,$user,$pass)=('X','unbekannt','weissnicht');
# Verbindung aufbauen
my $ssh = Net::SSH::Perl->new($host);
$ssh->login($user, $pass);
# Befehl absetzen
my($daten, $fehler) = $ssh->cmd('/pfad/zum/script/read_db.pl');
die("SSH Fehler ($fehler)") if($fehler);
print "DATEN:\n$daten";
# eigendlich unnötig
# Verbindung schließen.
undef($ssh);
Net::SSH: Bad host name: http://194.9.xxx.xx at test.pl line 11
![]() |
|< 1 2 3 >| | ![]() |
23 Einträge, 3 Seiten |