Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: A generic function/framework/mechanism for regular polling of data?
- X-seq: zsh-users 13122
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: Richard Hartmann <richih.mailinglist@xxxxxxxxx>
- Subject: Re: A generic function/framework/mechanism for regular polling of data?
- Date: Sun, 10 Aug 2008 06:14:32 -0700
- Cc: Zsh users list <zsh-users@xxxxxxxxxx>
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=d200807; d=spodhuis.org; h=Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=cjBSVy7+ilcYZHfTrrun/jd2YFQAixlWZrnyjUMZHGPlSze9MRpnMScrzKTpdumP+sEn3z+1DwJ+9WE0e7534RBQEiUqN3utmDG9Bh3cGx/mpYwZ0OxkDc1OAWgyZLDgSLwN5OlVUlaAT6WAM8fkkGrPgP3/gth2vWBLmEpb8Qo=;
- In-reply-to: <2d460de70808071833p8871ca5m19159361b6eb855b@xxxxxxxxxxxxxx>
- Mail-followup-to: Richard Hartmann <richih.mailinglist@xxxxxxxxx>, Zsh users list <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <2d460de70808071833p8871ca5m19159361b6eb855b@xxxxxxxxxxxxxx>
On 2008-08-08 at 03:33 +0200, Richard Hartmann wrote:
> I was wondering if a function existed that will use a pattern, target
> variables, interval & a data source for polling & parsing information
> regularly.
>
> For example, this function could be told to poll ACPI power status
> every X seconds and put the result into $foo. The same function
> could also keep track of unread mail, the temperature of CPU, HDD,
> etc and pretty much antything else you can get from a file or
> program and put all of those values into variables.
>
> Does any function like this exist?
Define periodic() and set $PERIOD; every $PERIOD seconds, periodic()
will be called, just before a prompt. If you don't cause a prompt to be
shown, the function won't be called.
This is done just after precmd() and just before the $WATCH and
$MAILCHECK checks.
There's ALSO a separate list of commands, called after the mailchecks,
maintained by the zsh/sched loadable module. Those are single-fire
commands, rather than repeating events.
For unread mail, look at $MAILCHECK, $mailpath and the mail_warning
option. That assumes mbox mail though.
-Phil
Attachment:
pgp24qO26xtGd.pgp
Description: PGP signature
Messages sorted by:
Reverse Date,
Date,
Thread,
Author