You are not logged in.

#1 2008-10-29 07:14:52

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Cronwhip - no more missed cronjobs

Cronwhip is a small script that can run missed cronjobs at startup. See the info page for more details:
http://xyne.archlinux.ca/projects/cronwhip

Last edited by Xyne (2012-08-23 23:39:59)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#2 2008-10-29 13:37:34

fflarex
Member
Registered: 2007-09-15
Posts: 466

Re: Cronwhip - no more missed cronjobs

Have you contributed anything that I haven't found useful?

Offline

#3 2008-10-30 22:45:14

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Cronwhip - no more missed cronjobs

fflarex wrote:

Have you contributed anything that I haven't found useful?

big_smile

I've uploaded it to the AUR now.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#4 2008-10-30 23:13:15

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: Cronwhip - no more missed cronjobs

Pretty nice! I've silently wished for something like this a couple of times in the past...

EDIT: the PKGBUILD in AUR depends on aria2 for some reason... cleanup?

Last edited by bender02 (2008-10-30 23:14:38)

Offline

#5 2008-10-30 23:29:34

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Cronwhip - no more missed cronjobs

bender02 wrote:

EDIT: the PKGBUILD in AUR depends on aria2 for some reason... cleanup?

Ooops, sorry about that. I copied the PKGBUILD from powerpill and forgot to remove the dep. It's fixed now.

Thanks for letting me know.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#6 2008-10-31 10:48:30

CuleX
Member
Registered: 2007-09-15
Posts: 107

Re: Cronwhip - no more missed cronjobs

Doesn't this something do like Anacron (http://anacron.sourceforge.net)?

Last edited by CuleX (2008-10-31 10:48:43)

Offline

#7 2008-10-31 11:05:53

foutrelis
Developer
From: Athens, Greece
Registered: 2008-07-28
Posts: 705
Website

Re: Cronwhip - no more missed cronjobs

CuleX wrote:

Doesn't this something do like Anacron (http://anacron.sourceforge.net)?

The OP specifically talks about this in his post:

Xyne wrote:

Unlike anacron and others (as I've understood it), you do NOT need to give cronwhip its own tasklist. It parses crontab directly to find out what cron should have done.

Last edited by foutrelis (2008-10-31 11:06:34)

Offline

#8 2008-11-03 21:46:48

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: Cronwhip - no more missed cronjobs

Xyne wrote:
bender02 wrote:

EDIT: the PKGBUILD in AUR depends on aria2 for some reason... cleanup?

Ooops, sorry about that. I copied the PKGBUILD from powerpill and forgot to remove the dep. It's fixed now.

Thanks for letting me know.

It seems that the dependency is not the only thing you forgot to edit, check the package description:

A wrapper for pacman that speeds up package retrieval by using aria2c for concurrent/segmented downloads.

Useless to say, I was completely puzzled before reading all the posts big_smile


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#9 2008-11-04 01:11:35

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Cronwhip - no more missed cronjobs

*hangs head in shame*

Thanks finferflu. It's fixed now.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#10 2008-11-04 01:33:42

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: Cronwhip - no more missed cronjobs

Ah, by the way, I forgot to say thank you for this handy script! smile


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#11 2009-04-06 18:02:32

oopsicrappe
Member
Registered: 2009-01-18
Posts: 17

Re: Cronwhip - no more missed cronjobs

Is there any advantage to using dcron + cronwhip rather than fcron?

Offline

#12 2009-04-06 22:27:57

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Cronwhip - no more missed cronjobs

oopsicrappe wrote:

Is there any advantage to using dcron + cronwhip rather than fcron?

I don't know because I'm not familiar with fcron. It probably depends on what you need your cron daemon to do. Use whatever works for you. smile


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#13 2009-08-05 14:33:03

gav616
Member
Registered: 2008-01-16
Posts: 182

Re: Cronwhip - no more missed cronjobs

I'm getting

Argument "@reboot" isn't numeric in numeric eq (==) at /usr/bin/cronwhip line 112.

Offline

#14 2009-08-09 00:56:51

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Cronwhip - no more missed cronjobs

I've added support for @reboot, @yearly, etc.

Try the latest version (>=2.0.1) and let me know if it resolves the issue.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#15 2009-08-11 09:44:41

mariusmeyer
Member
From: Norway
Registered: 2009-04-25
Posts: 244

Re: Cronwhip - no more missed cronjobs

Hey Xyne. Thanks for your contributions, I greatly enjoy reflector and have tried powerpill in the past.

I would like to put cronwhip in my DAEMONS-array in rc.conf. Should I:
1) replace cron with cronwhip?
2) or start cron before/after cronwhip?

Cheers,
M

Offline

#16 2009-08-11 17:19:23

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Cronwhip - no more missed cronjobs

mariusmeyer wrote:

Hey Xyne. Thanks for your contributions, I greatly enjoy reflector and have tried powerpill in the past.

I would like to put cronwhip in my DAEMONS-array in rc.conf. Should I:
1) replace cron with cronwhip?
2) or start cron before/after cronwhip?

Cheers,
M

Hi mariusmeyer,

Cronwhip isn't a daemon and it cannot replace cron. It should only be run once shortly after booting to run any cronjobs that would have been run since the last system shutdown. I recommend that you simply add the following line to /etc/rc.local to have it run missed cronjobs 5 minutes after startup:

(sleep 300 && /usr/bin/cronwhip) &

My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#17 2009-08-12 09:09:42

mariusmeyer
Member
From: Norway
Registered: 2009-04-25
Posts: 244

Re: Cronwhip - no more missed cronjobs

Oh, I see. Thanks for the explanation! big_smile

Offline

#18 2009-08-12 11:04:34

jelly
Administrator
From: /dev/null
Registered: 2008-06-10
Posts: 714

Re: Cronwhip - no more missed cronjobs

@Xyne:

Am i going to give you taco's ?? YES

/me hands Xyne some taco's

This is really a good idea because normally i make a backup every day at six o'clock but if i am a day out or the pc isn't on it doesnt backup so this script will fix that !

Offline

#19 2009-08-12 14:31:04

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Cronwhip - no more missed cronjobs

@mariusmeyer
np big_smile

@jelly
WOOOOOOOT, TACOS!
*gladly munches away while wondering how long it will take cactus to show up*


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#20 2009-08-13 19:09:52

rwd
Member
Registered: 2009-02-08
Posts: 664

Re: Cronwhip - no more missed cronjobs

This looks like a nice 'arch way' script. One question though. The manpage says:

Cronwhip  runs  cronjobs that would have been run in the time since the last system shutdown

Does this also include missed cronjobs because of suspending to ram/disk? If so it would be clearer to add it to the package description and manpage. And I assume I need to put it somewhere else than /etc/rc.local if I want it to run at waking from suspend right?

Last edited by rwd (2009-08-13 19:13:36)

Offline

#21 2009-08-13 19:25:23

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Cronwhip - no more missed cronjobs

I use the output of "last -x" to get the shutdown time. If that contains output for waking from suspend then I can update cronwhip to recognize that. I would need an example of the output though.

I don't know what the best way would be to run it when waking from suspend. I think I've seen scripts on the forum for waking events though, so you might find something relevant with a few forum searches.

Btw, using the output of "last -x" was the best (read: simplest and most universal) solution that I found at the time of writing cronwhip. I haven't looked into improving it since then because it works flawlessly here, but if there is a better way then I would consider implementing it.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#22 2009-08-17 22:04:04

gav616
Member
Registered: 2008-01-16
Posts: 182

Re: Cronwhip - no more missed cronjobs

working now good after the update smile ty


Xyne wrote:

(sleep 300 && /usr/bin/cronwhip) &

maybe a comment after compiling about adding this to '/etc/rc.local' ?

Offline

#23 2009-08-17 22:25:36

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Cronwhip - no more missed cronjobs

Good idea. I've added a post_install message.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#24 2009-12-17 07:21:41

drostin77
Member
Registered: 2009-07-15
Posts: 45

Re: Cronwhip - no more missed cronjobs

I made a VERY hacky way to get this working with suspend/resume at lunch (20 minutes, no promises:P).  I would not really recommend this, but it is stable after a few reboots/suspends/hibernates for me at the moment.  All I do is make a pm-suspend action that dumps the time (date +%s) into a file on suspend/hibernate and runs a very-slightly-modified cronwhip on resume/thaw.  If you actually try this code you should take note that the second file is redirecting cronwhip's verbose output to ~/.cronwhip.

changes to cronwhip file

54a55
> my $last_suspend  = `cat /var/log/whendidisuspend.log`;
60a62,65
> my ($slast) = ($last_suspend =~ m/(\d+)/);
> if ($slast > $last) {
>   $last = $slast
> }

/etc/pm/sleep.d/99cronwhip:

#!/bin/bash

case "$1" in
hibernate|suspend)
echo $(date +%s) > /var/log/whendidisuspend.log
;;
resume|thaw)
/usr/local/bin/cronwhip -v >> /home/me/.cronwhip
;;
*)
exit $NA
;;
esac

exit $?

EDIT:
Oh and I don't really know perl or anything about pm-utils, heheh.

Last edited by drostin77 (2009-12-17 07:23:07)

Offline

#25 2010-01-22 20:06:26

raymboard
Member
Registered: 2010-01-22
Posts: 61

Re: Cronwhip - no more missed cronjobs

If I set a daily cron job and left the computer turned off for a week then when I turned it back on would the cron job run 7 times?


Linux is not an operating system it's a kernel. You're using GNU/Linux. http://www.gnu.org/gnu/linux-and-gnu.html

Offline

Board footer

Powered by FluxBB