Thread kleiner Timer: geht das? (11 answers)
Opened by Gast at 2004-07-10 00:30

Gast Gast
 2004-07-10 00:30
#3114 #3114
Hallo.
Ich bin ein totaler Perl-Noob und sollte eine Art Timer basteln.
Ich habe das folgendermassen gelöst:
start.pl
Ruft timer.pl auf und kann danach geschlossen werden.
timer.pl
enthält folgendes:
Code: (dl )
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
print "Content-type: text/plain\n\n";

$value = 60; #sekunden
$loop = 0; #wiederholungen
$c_file = "run.txt"; #kontrollfile


if($loop>=1)
{
for($i=0;$i<$loop;$i++)
{
sleep $value;

system("$perl_path action.pl");
}
}
else
{
while(-e $c_file)
{
sleep $value;

system("$perl_path action.pl");
}
}

action.pl
Macht irgendwas :D

Es funktioniert eigentlich ganz gut, allerdings läuft Perl die ganze Zeit über (auch wenn es/er schläft). Ich weiss jetzt nicht ob das Performance kostet und wollte daher mal nachfragen und mich bei Gelegenheit eines Besseren belehren lassen :)
Danke!

View full thread kleiner Timer: geht das?