Unix Technical Forum

a better cron?

This is a discussion on a better cron? within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> Dillon's Cron (and every other cron as far as I can see) seems slightly backward in its abilities. It ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-19-2008, 03:59 PM
chris dunn
 
Posts: n/a
Default a better cron?

Dillon's Cron (and every other cron as far as I can see)
seems slightly backward in its abilities.

It can't accommodate a one-off task in a following year.

It can't accept dates such as "third sunday in month" or
"last day" or "first monday", all of which can be useful
at times.

Does anybody know an alternative that will accept these
scheduled times?

Kalarm doesn't get it done because it only runs when
someone is logged in,



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-19-2008, 03:59 PM
Joost Kremers
 
Posts: n/a
Default Re: a better cron?

chris dunn wrote:
> Dillon's Cron (and every other cron as far as I can see)
> seems slightly backward in its abilities.
>
> It can't accommodate a one-off task in a following year.


by one-off task, you mean a task that is meant to be run only once? cron
isn't the right tool for that, you use 'at' instead.

--
Joost Kremers joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-19-2008, 03:59 PM
Stuart Winter
 
Posts: n/a
Default Re: a better cron?

On 29 Sep 2004 21:36:44 GMT, joostkremers@yahoo.com wrote:

>> Dillon's Cron (and every other cron as far as I can see)
>> seems slightly backward in its abilities.
>>
>> It can't accommodate a one-off task in a following year.

>
> by one-off task, you mean a task that is meant to be run only once? cron
> isn't the right tool for that, you use 'at' instead.


(what Joost said)

Also, dcron has suffered less (if any - can't remember) security
vulnerabilities than Dixie's crond *and* what's more, it has a good
man page with examples where as Dixie's crond does not.
The only thing dcron does not support (iirc) is cron.{allow,deny} but
even when I used to manage shell servers, I never found this to be a
problem.

When ever I have to work out a cron job on a Red Hat box or anything
other than Slackware, I always login to my Slackware box to check
out the examples from dcron's man page.

--
Stuart Winter
www.interlude.org.uk & www.armedslack.org
| "Washing machines live longer with Calgon"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-19-2008, 03:59 PM
Sylvain Robitaille
 
Posts: n/a
Default Re: a better cron?

chris dunn wrote:

> Dillon's Cron (and every other cron as far as I can see)
> seems slightly backward in its abilities.


You may be thinking about it wrong; In particular, you may be trying to
do things that cron isn't intended for ...

> It can't accommodate a one-off task in a following year.


That's right, but at(1) can.

> It can't accept dates such as "third sunday in month" or
> "last day" or "first monday", all of which can be useful
> at times.


For these, you may need to do some shell script magic, to get your cron
job to run exactly when you want, then have it called more frequently
(weekly, daily, etc) than it will actually do any work.

First Monday of the month, though is still pretty easy: It will be the
only Monday that falls between the 1st and 7th of the month. Your job
runs on Mondays, and checks that the date is less than 8 before doing
any work.

"Last day" can also be done easily in the called script itself, (check
the date tomorrow; if it's the 1st, then today is the last day of the
month), or you can use 3 lines in the crontab for the one job, if you
don't mind February jobs not always falling on exactly the last day.

Third Sunday in the month is a little tougher, and I would propose
that this could be determined with some reasonably skillful shell
programming.

> Does anybody know an alternative that will accept these
> scheduled times?


Well, I hope that the above suggestions help ...

--
----------------------------------------------------------------------
Sylvain Robitaille syl@alcor.concordia.ca

Systems analyst Concordia University
Instructional & Information Technology Montreal, Quebec, Canada
----------------------------------------------------------------------
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-19-2008, 03:59 PM
James Michael Fultz
 
Posts: n/a
Default Re: a better cron?

* Stuart Winter <use.reply.to@interlude.org.uk>:
[ ... ]
> Also, dcron has suffered less (if any - can't remember) security
> vulnerabilities than Dixie's crond *and* what's more, it has a good

[ ... ]

I think that you mean Vixie's crond rather than Dixie's crond. Well,
I've never heard of the latter, at least, despite living in the Southern
US. ;-)

--
James Michael Fultz <xyzzy@sent.as.invalid>
Remove this part when replying ^^^^^^^^
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-19-2008, 03:59 PM
Stuart Winter
 
Posts: n/a
Default Re: a better cron?

On Thu, 30 Sep 2004 01:27:21 GMT, xyzzy@sent.as.invalid wrote:

>> Also, dcron has suffered less (if any - can't remember) security
>> vulnerabilities than Dixie's crond *and* what's more, it has a good

> [ ... ]
>
> I think that you mean Vixie's crond rather than Dixie's crond. Well,
> I've never heard of the latter, at least, despite living in the Southern
> US. ;-)


Paul Vixie - yes, vixie cron :-)

--
Stuart Winter
www.interlude.org.uk & www.armedslack.org
| "Washing machines live longer with Calgon"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-19-2008, 04:00 PM
buck
 
Posts: n/a
Default Re: a better cron?

On Wed, 29 Sep 2004 08:07:09 -0400, chris dunn
<paledread@linuxmail.org> wrote:

>Dillon's Cron (and every other cron as far as I can see)
>seems slightly backward in its abilities.
>
>It can't accommodate a one-off task in a following year.
>
>It can't accept dates such as "third sunday in month" or
>"last day" or "first monday", all of which can be useful
>at times.
>
>Does anybody know an alternative that will accept these
>scheduled times?
>
>Kalarm doesn't get it done because it only runs when
>someone is logged in,


You may want to look at fcron.

http://fcron.free.fr

buck
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-19-2008, 04:00 PM
TTK Ciar
 
Posts: n/a
Default Re: a better cron?

Once upon a time, chris dunn <paledread@linuxmail.org> said:
>
>Does anybody know an alternative that will accept these
>scheduled times?


It might be overkill, but if you're looking for a "everything
including the kitchen sink" alternative, there's GNU/cfengine:

http://www.cfengine.org

It's essentially an administration bot that allows you to
describe a policy for how a system is to be run (including
permissions, daemons, tripwires, mountpoints, etc) and then
periodically checks everything to make sure it's right. But
it can also be used as a more-featureful cron, with all the
scheduling options your heart desires.

-- TTK

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-19-2008, 04:02 PM
chris dunn
 
Posts: n/a
Default Re: a better cron?

On 2004-09-29, Sylvain Robitaille <syl@alcor.concordia.ca> wrote:

> chris dunn wrote:
>
>> Dillon's Cron (and every other cron as far as I can see)
>> seems slightly backward in its abilities.

>
> You may be thinking about it wrong; In particular, you may be trying to
> do things that cron isn't intended for ...
>
>> It can't accommodate a one-off task in a following year.

>
> That's right, but at(1) can.
>
>> It can't accept dates such as "third sunday in month" or
>> "last day" or "first monday", all of which can be useful
>> at times.

>
> For these, you may need to do some shell script magic, to get your cron
> job to run exactly when you want, then have it called more frequently
> (weekly, daily, etc) than it will actually do any work.
>
> First Monday of the month, though is still pretty easy: It will be the
> only Monday that falls between the 1st and 7th of the month. Your job
> runs on Mondays, and checks that the date is less than 8 before doing
> any work.
>
> "Last day" can also be done easily in the called script itself, (check
> the date tomorrow; if it's the 1st, then today is the last day of the
> month), or you can use 3 lines in the crontab for the one job, if you
> don't mind February jobs not always falling on exactly the last day.
>
> Third Sunday in the month is a little tougher, and I would propose
> that this could be determined with some reasonably skillful shell
> programming.
>
>> Does anybody know an alternative that will accept these
>> scheduled times?

>
> Well, I hope that the above suggestions help ...


Thanks for this.

It all falls into place with some additional scripting.

Perfect.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-19-2008, 04:03 PM
Sylvain Robitaille
 
Posts: n/a
Default OT: date calculations (was Re: a better cron?)

A few days ago, I wrote in a followup message to Chris Dunn:

> Third Sunday in the month is a little tougher, and I would propose
> that this could be determined with some reasonably skillful shell
> programming.


I've whipped together a possible solution to this. I have to admit it
seems rather kludgy, and I'm sure it could be done even more elegantly,
but this at least works on any UNIX or UNIX-like system, even with only
a basic installation. You've been warned, though: this isn't pretty ...

A simple script follows that uses my solution ...

#!/bin/sh

# Test script to see if today is the third Sunday of the month ...

if [ `date +%d` -eq `cal|egrep '^ ?[0-9]'|awk 'NR==3 {print $1}'` ]
then
echo "Today is the third Sunday of the month"
fi

--
----------------------------------------------------------------------
Sylvain Robitaille syl@alcor.concordia.ca

Systems analyst Concordia University
Instructional & Information Technology Montreal, Quebec, Canada
----------------------------------------------------------------------
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:14 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com