GNU/Linux >> Linux Esercitazione >  >> Linux

Quando viene eseguito `cron.daily`?

Soluzione 1:

Per le distribuzioni che menzioni:

Su CentOS 5.4 (dovrebbe essere lo stesso per RHEL5)

grep run-parts /etc/crontab

01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

Quindi cron.daily viene eseguito alle 04:02.

Lo stesso su CentOS 4.8

Soluzione 2:

Dalla pagina man:

 Cron also searches for /etc/anacrontab

/etc/anacrontab nel mio sistema (Fedora 12) :

1       5       cron.daily              nice run-parts /etc/cron.daily
7       25      cron.weekly             nice run-parts /etc/cron.weekly
@monthly 45     cron.monthly            nice run-parts /etc/cron.monthly

Vedi anche man anacrontab

Soluzione 3:

Per CentOS 6, devi grep /etc/anacrontab e la risposta varia se il server/laptop/dekstop/etc è stato spento o meno.

cat /etc/anacrontab 
# /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22

#period in days   delay in minutes   job-identifier   command
1   5   cron.daily      nice run-parts /etc/cron.daily
7   25  cron.weekly     nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly        nice run-parts /etc/cron.monthly

Quindi, tra le 3:00 e le 22:00** (dopo il riavvio e dopo che la macchina è rimasta attiva per 5 minuti^^), eseguire /etc/cron.daily. Se non viene eseguito il riavvio, il lavoro dovrebbe essere eseguito alle 3:05++.

** As defined by START_HOURS_RANGE
^^ As defined by FIELD_TWO (i.e. the 5 after the 1 in the cron.daily line)
++ plus a random time between 0 and 45 minutes as defined by RANDOM_DELAY

Riferimento:http://linux.die.net/man/5/anacrontab

Soluzione 4:

Per i sistemi SuSE (in particolare SLES 11.1 e openSuSE 10.3) il tempo di esecuzione giornaliero degli script /etc/cron.daily è controllato dal valore di DAILY_TIME variabile impostata in /etc/sysconfig/cron file.

Se la variabile DAILY_TIME non è impostata, il valore predefinito è:(ora dell'ultimo avvio + 15 minuti).

Soluzione 5:

Su Ubuntu, troverai un file /etc/crontab, da dove è configurato. Immagino sia qualcosa di simile su RH e Centos.


Linux
  1. In che modo Linux gestisce più separatori di percorsi consecutivi (/home////nomeutente///file)?

  2. Quando usare /dev/random vs /dev/urandom?

  3. Come viene aggiornato /etc/motd?

  4. CentOS / RHEL:come recuperare dal file /etc/passwd cancellato

  5. Che cos'è Anacron e utilizzo di Anacron in Linux

Il modo giusto per modificare i file /etc/passwd e /etc/group in Linux

Comprendere i file /proc/mounts, /etc/mtab e /proc/partitions

Quando dovrei usare /dev/shm/ e quando dovrei usare /tmp/?

Differenza tra /etc/hosts e /etc/resolv.conf

Come configurare /etc/issues per mostrare l'indirizzo IP per eth0

Devo modificare /etc/crontab o eseguire crontab -e come root?