Perl: Sub zu einem bestimmten zeitpunkt ausführen

Chromatin

0
Mitarbeiter
Moin

Ich stehe ein wenig auf dem Schlauch.

Ich will in Perl eine Funktion zu einem bestimmten Zeitpunkt ausführen.
Ich will ausdrücklich _kein_ sleep verwenden oder das skript über "at" steuern.

Hat da jemand ein Beispielcode?
 
Was für Systemvoraussetzungen hast du denn und wie können wir uns den Ablauf allgemein vorstellen?

Bei deiner allgemeinen Beschreibung fallen mir eigentlich 2 Varianten ein:
1) Cron Job
2) ein dauerhaft laufendes Systemskript, was dann zu bestimmten Zeiten deine Sub aufruft.

Variante 1 wäre natürlich zu bevorzugen, aber ob überhaupt eine davon für dich umsetzbar wäre, weiß ich halt nicht
 
2) ein dauerhaft laufendes Systemskript, was dann zu bestimmten Zeiten deine Sub aufruft.

Ja, sorry.

Also das Skript soll schon laufen und nix tun - bis zum Zeitpunkt X.
Eine unschöne Möglichkeit wäre eine Schleife, wo ich immer localtime() abfange. Allerdings wünsche ich mir etwas was "echtzeitiger" ist.
 
This module provides a simple but complete cron like scheduler. I.e this modules can be used for periodically executing Perl subroutines. The dates and parameters for the subroutines to be called are specified with a format known as crontab entry ("METHODS", add_entry() and crontab(5))

The philosophy behind Schedule::Cron is to call subroutines periodically from within one single Perl program instead of letting cron trigger several (possibly different) perl scripts. Everything under one roof. Furthermore Schedule::Cron provides mechanism to create crontab entries dynamically, which isn't that easy with cron.

Schedule::Cron knows about all extensions (well, at least all extensions I'm aware of, i.e those of the so called "Vixie" cron) for crontab entries like ranges including 'steps', specification of month and days of the week by name or coexistence of lists and ranges in the same field. And even a bit more (like lists and ranges with symbolic names).
Quelle: Schedule::Cron

Dürfte doch genau das sein, was du suchst.
 
Zurück
Oben