PDA

View Full Version : crontab ogni ultimo giorno del mese


skorpius
13-01-2004, 09:34
Raga, qualcuno ha mai provato ad impostare una cron come da oggetto?

Io ho provato con
1 0 28-31 * * [ "$(date +%d -d +1day)" -eq "1" ] && comando

ma non funzia...
qualcuno può aiutarmi???

kingv
13-01-2004, 12:45
imposta nel crontab uno script che gira nei giorni 28,29,30,31


nello scipt scrivi qualcosa del tipo:




TODAY=`date +%d`
TOMORROW=`date +%d -d "1 day"`

if [ $TOMORROW -lt $TODAY ]; then
# Qui metti quello che vuoi fare.
fi

gurutech
13-01-2004, 12:47
e fare 12 job di cron ?

kingv
13-01-2004, 13:00
Originariamente inviato da gurutech
e fare 12 job di cron ?


:Puke: :Puke: :Puke:



:D :D

gurutech
13-01-2004, 13:54
Originariamente inviato da kingv
e fare 12 job di cron ?
:Puke: :Puke: :Puke:

:D :D

eddai era ironica

kingv
13-01-2004, 13:57
Originariamente inviato da gurutech
eddai era ironica



l'avevo capito ;)

skorpius
14-01-2004, 08:34
grazie a tutti e 2, uno sul serio, l'altro x l'ironia.
Avevo pensato a risolvere il prob SOLO all'interno della crontab, ma evidentemente non è possibile, bisogna agire a livello di script.

Nel mio caso, è uno script php, ho utilizzato una getdate() e, dopo aver aumentato il valore del giorno di uno, utilizzo una checkdate(mon, day+1, year) x vedere se ottengo una data "legale".
Se non lo è, vuol dire che siamo all'ultimo giorno del mese :D

Hardware Upgrade Forum Database Error
Database Error Database error
The Hardware Upgrade Forum database has encountered a problem.

Please try the following:
  • Load the page again by clicking the Refresh button in your web browser.
  • Open the www.hwupgrade.it home page, then try to open another page.
  • Click the Back button to try another link.
The www.hwupgrade.it forum technical staff have been notified of the error, though you may contact them if the problem persists.
 
We apologise for any inconvenience.