cron day of month megadasi formalya

2010-03-02 bef zés Fried Zoltan
Sziasztok,

A kovetkezot raktam a crontab-ba:
53 10 1-7 * 5 oracle echo XXX
aminek az eredmenye, hogy minden nap lefut a parancs, nem csak penteken!

Az ertelmezesem szerint a lenti sor egyenragu a fentivel:
53 10 1,2,3,4,5,6,7 * 5 oracle echo XXX
viszont ez ugy mukodik ahogy szerintem kene.

A feladat eredetileg az volt, hogy aktualis honap 1. het penteken 1 adott
script fusson le, a kovetkezo penteken egy masik, es igy tovabb.
A fenti config az 1. heti utemezes lett volna.

A rendszer: Red Hat Enterprise Linux ES release 5 (Nahant)

most ez bug vagy features, esetleg elneztem valamit?

zoli



_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux


Re: cron day of month megadasi formalya

2010-03-02 bef zés Gábriel Ákos
On Tue, 2010-03-02 at 11:22 +0100, Fried Zoltan wrote:
 Sziasztok,
 
 A kovetkezot raktam a crontab-ba:
 53 10 1-7 * 5 oracle echo XXX
 aminek az eredmenye, hogy minden nap lefut a parancs, nem csak penteken!

man 5 crontab:

Note: The day of a command's execution can be specified by two fields —
day of month, and day of week.  If both fields  are  restricted  (i.e.,
aren't  *),  the command will be run when either field matches the
current time. 

Segitek ertelmezni: az 1-7 helyett *-t kell irnod.


-- 
Üdvözlettel,
Gábriel Ákos
-=E-Mail :akos.gabr...@i-logic.hu|Web:  http://www.i-logic.hu=-
-=Tel/fax:+3612391618|Mobil:+36209278894 =-

_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux

Re: cron day of month megadasi formalya

2010-03-02 bef zés Laszlo Beres
2010/3/2 Fried Zoltan zoltan.fr...@deirf.hu:

 A kovetkezot raktam a crontab-ba:
 53 10 1-7 * 5 oracle echo XXX
 aminek az eredmenye, hogy minden nap lefut a parancs, nem csak penteken!

 Az ertelmezesem szerint a lenti sor egyenragu a fentivel:
 53 10 1,2,3,4,5,6,7 * 5 oracle echo XXX
 viszont ez ugy mukodik ahogy szerintem kene.

 A feladat eredetileg az volt, hogy aktualis honap 1. het penteken 1 adott
 script fusson le, a kovetkezo penteken egy masik, es igy tovabb.
 A fenti config az 1. heti utemezes lett volna.

man 5 crontab

field  allowed values
  -  --
  minute 0-59
  hour   0-23
  day of month   1-31
  month  1-12 (or names, see below)
  day of week0-7 (0 or 7 is Sun, or use names)

Nalad ez ugy nez ki, hogy:

53 perc
10 ora
a honap 1-7 napja kozott
minden honapban
ES minden penteken

En ugy csinalnam, hogy a cronjobon belul megneznem, 1. es 7. kozott
milyen nap van, es ha az pentekre esik, akkor run.

-- 
László BéresUnix system engineer
http://www.google.com/profiles/beres.laszlo
_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux

Re: cron day of month megadasi formalya

2010-03-02 bef zés Fried Zoltan
On Tue, March 2, 2010 11:28, Gábriel Ákos wrote:
 Note: The day of a command's execution can be specified by two fields —
 day of month, and day of week.  If both fields  are  restricted  (i.e.,
 aren't  *),  the command will be run when either field matches the
 current time. 
Ezt tenyleg beneztem. koszi.
zoli


_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux

Re: cron day of month megadasi formalya

2010-03-02 bef zés Zs
Hi!


 A kovetkezot raktam a crontab-ba:
 53 10 1-7 * 5 oracle echo XXX
 aminek az eredmenye, hogy minden nap lefut a parancs, nem csak penteken!
 
 man 5 crontab:
 
 Note: The day of a command's execution can be specified by two fields —
 day of month, and day of week.  If both fields  are  restricted  (i.e.,
 aren't  *),  the command will be run when either field matches the
 current time. 
 
 Segitek ertelmezni: az 1-7 helyett *-t kell irnod.
 
Ez önmagában kevés, ugyanis az eredeti feltétel szerint
pénteknek is kell lennie, meg a hónap első hetének is.
Ha az 1-7 helyére csillag kerül, akkor az 5 miatt valóban
csak pénteken fog futni a script - viszont a hónap összes
péntekén, nem csak az elsőn.
Ennek fényében tisztán crontabból szerintem a feladat nem
megoldható: a crontab minden pénteken elindítja a scriptet
és a scriptnek kell első lépésben megnéznie, hogy a hónap
első hete van-e?
Ha tévednék és a feladat mégis megoldható tisztán crontab
beállítással, akkor érdekel a megoldás!


Zsolt

_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux