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 28 29 30 31 32 33 34 35 36 37 38 39
sub test(){ my @b; foreach(1..10){ $b[$_]->{send_to} = "gustl1und1\@online.de"; $b[$_]->{username} = "Gustl"; } send_emails(\@b); } sub send_emails{ my @mail = @{$_[0]}; my $type = $_[1]; my $mailprog = '/usr/lib/sendmail'; my $pid = undef; foreach(@mail){ if (defined($pid = fork)) { if ($pid) { #Eltern #print "Eltern: Kind $i ($pid) gestartet \n"; } else { #Kind my $mailfrom = $Glob::mailfrom_support; my $name = "TRAIN your programmer Support"; my $subject = "TRAIN your programmer - Test"; my $body = "TEXTE TEXT TEXT TEXT!"; open (MAIL, "|$mailprog $_->{send_to}") || die "Cant open $mailprog!\n"; print MAIL ("To: $_->{send_to}\n"); print MAIL ("From: $name <$mailfrom>;\n"); print MAIL ("Subject: $subject\n\n"); print MAIL ("$body"); close (MAIL); last; } } } }
INSERT INTO foo (a,b,c) VALUES (1,2,3), (4,5,6), (7,8,9), ...
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 28
#! /usr/bin/perl use strict; use warnings; use CGI; my $cgi = CGI->new; print $cgi->header('text/plain'); print "Gestartet: " . localtime($^T) . "\n"; sleep int(rand(6)+1); print "Ausgabe Ende: " . localtime() . "\n"; # hiernach ist keine Ausgabe mehr an den Browser moeglich close STDOUT; # andere Jobs, die Zeit kosten sleep 5; # Kontrolle nach STDERR (ins Log, ...) warn "andere Jobs Ende: " . localtime() . "\n"; # Skript Ende exit 0; __END__
close STDOUT;