How efficient is 'sleep'?
Brian Inglis
Brian.Inglis@Shaw.ca
Fri Dec 15 22:27:59 GMT 2023
On 2023-12-15 14:55, Backwoods BC via Cygwin wrote:
> I have quite a few "service-like" scripts that I put into the
> background and then have them wake up on a regular basis to do
> something. I use 'sleep' for the timing of the wakeup periods.
>
> My question is: How efficient is 'sleep'? I know of other OSes that
> just set a timer flag and the process isn't allocated any CPU time
> until the timer expires.
>
> I know that creating a service or even using Task Scheduler are more
> "proper" ways of doing this, but they are also much more work and
> would require a significant learning curve as my background is
> embedded systems, not Windows. I know that my lazy way probably has a
> penalty, but just how bad is it?
Install Cygwin packages cron plus cygrunsrv to run daemons as services.
Setup cron service by running /usr/sbin/cron-config as elevated admin.
Then use crontab to schedule scripts every so often or at specific times or days.
Install package and read man pages or see the current package repo:
https://github.com/vixie/cron/blob/master/crontab.5
--
Take care. Thanks, Brian Inglis Calgary, Alberta, Canada
La perfection est atteinte Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut
-- Antoine de Saint-Exupéry
More information about the Cygwin
mailing list