Cron não imprime para syslog

3

Tenho o seguinte crontab file -

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the 'crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

* * * * * mango echo hi >> /home/mango/test

Eu reiniciei o serviço usando sudo service cron restart , mas o arquivo não aparece. Então, verifiquei o arquivo de log para ver o problema.

Sep 18 09:24:41 dpiplserver rsyslogd: [origin software="rsyslogd" swVersion="5.8.6" x-pid="869" x-info="http://www.rsyslog.com"] rsyslogd was HUPed
Sep 18 09:24:51 dpiplserver anacron[1157]: Job 'cron.daily' terminated
Sep 18 09:24:51 dpiplserver anacron[1157]: Normal exit (1 job run)
Sep 18 09:39:01 dpiplserver CRON[2349]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete)
Sep 18 10:09:01 dpiplserver CRON[2399]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete)
Sep 18 10:16:08 dpiplserver kernel: [ 4726.374034] usb 2-1.5: new high-speed USB device number 3 using ehci_hcd
Sep 18 10:39:01 dpiplserver CRON[2803]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete)
Sep 18 10:50:21 dpiplserver kernel: [ 6773.998690] init: cron main process (1192) killed by TERM signal
Sep 18 10:50:21 dpiplserver cron[2880]: (CRON) INFO (pidfile fd = 3)
Sep 18 10:50:21 dpiplserver cron[2881]: (CRON) STARTUP (fork ok)
Sep 18 10:50:21 dpiplserver cron[2881]: (*system*) INSECURE MODE (group/other writable) (/etc/crontab)
Sep 18 10:50:21 dpiplserver cron[2881]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Sep 18 10:52:17 dpiplserver kernel: [ 6890.091067] init: cron main process (2881) killed by TERM signal
Sep 18 10:52:17 dpiplserver cron[2905]: (CRON) INFO (pidfile fd = 3)
Sep 18 10:52:17 dpiplserver cron[2906]: (CRON) STARTUP (fork ok)
Sep 18 10:52:17 dpiplserver cron[2906]: (*system*) INSECURE MODE (group/other writable) (/etc/crontab)
Sep 18 10:52:17 dpiplserver cron[2906]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Sep 18 10:54:41 dpiplserver kernel: [ 7033.797057] init: cron main process (2906) killed by TERM signal
Sep 18 10:54:41 dpiplserver cron[2937]: (CRON) INFO (pidfile fd = 3)
Sep 18 10:54:41 dpiplserver cron[2938]: (CRON) STARTUP (fork ok)
Sep 18 10:54:41 dpiplserver cron[2938]: (*system*) INSECURE MODE (group/other writable) (/etc/crontab)
Sep 18 10:54:41 dpiplserver cron[2938]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Sep 18 10:56:01 dpiplserver cron[2938]: (*system*) INSECURE MODE (group/other writable) (/etc/crontab)
Sep 18 10:56:57 dpiplserver kernel: [ 7168.922614] init: cron main process (2938) killed by TERM signal
Sep 18 10:56:57 dpiplserver cron[2953]: (CRON) INFO (pidfile fd = 3)
Sep 18 10:56:57 dpiplserver cron[2954]: (CRON) STARTUP (fork ok)
Sep 18 10:56:57 dpiplserver cron[2954]: (*system*) INSECURE MODE (group/other writable) (/etc/crontab)
Sep 18 10:56:57 dpiplserver cron[2954]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Sep 18 10:59:34 dpiplserver kernel: [ 7325.393315] init: cron main process (2954) killed by TERM signal
Sep 18 10:59:34 dpiplserver cron[2967]: (CRON) INFO (pidfile fd = 3)
Sep 18 10:59:34 dpiplserver cron[2968]: (CRON) STARTUP (fork ok)
Sep 18 10:59:34 dpiplserver cron[2968]: (*system*) INSECURE MODE (group/other writable) (/etc/crontab)
Sep 18 10:59:34 dpiplserver cron[2968]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Sep 18 11:00:21 dpiplserver kernel: [ 7372.324581] init: cron main process (2968) killed by TERM signal
Sep 18 11:00:21 dpiplserver cron[2977]: (CRON) INFO (pidfile fd = 3)
Sep 18 11:00:21 dpiplserver cron[2978]: (CRON) STARTUP (fork ok)
Sep 18 11:00:21 dpiplserver cron[2978]: (*system*) INSECURE MODE (group/other writable) (/etc/crontab)
Sep 18 11:00:21 dpiplserver cron[2978]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Sep 18 11:09:01 dpiplserver CRON[3060]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete)
Sep 18 11:09:18 dpiplserver crontab[3068]: (mango) LIST (mango)
Sep 18 11:09:50 dpiplserver crontab[3089]: (root) LIST (root)
Sep 18 11:13:34 dpiplserver kernel: [ 8163.398965] init: cron main process (2978) killed by TERM signal
Sep 18 11:13:34 dpiplserver cron[3144]: (CRON) INFO (pidfile fd = 3)
Sep 18 11:13:34 dpiplserver cron[3145]: (CRON) STARTUP (fork ok)
Sep 18 11:13:34 dpiplserver cron[3145]: (*system*) INSECURE MODE (group/other writable) (/etc/crontab)
Sep 18 11:13:34 dpiplserver cron[3145]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Sep 18 11:15:22 dpiplserver kernel: [ 8271.390434] init: cron main process (3145) killed by TERM signal
Sep 18 11:15:22 dpiplserver cron[3163]: (CRON) INFO (pidfile fd = 3)
Sep 18 11:15:22 dpiplserver cron[3164]: (CRON) STARTUP (fork ok)
Sep 18 11:15:22 dpiplserver cron[3164]: (*system*) INSECURE MODE (group/other writable) (/etc/crontab)
Sep 18 11:15:22 dpiplserver cron[3164]: (CRON) INFO (Skipping @reboot jobs -- not system startup)

Eu esperava que o arquivo de log mostrasse que ele executou o comando ou o erro encontrado. Por que não imprime sucesso nem erro?

    
por Kshitiz Sharma 18.09.2013 / 07:57

1 resposta

6

Por favor, note que o arquivo /etc/crontab tem permissões erradas, o que faz com que cron ignore o arquivo e não execute as tarefas dentro desse arquivo:

Sep 18 11:15:22 dpiplserver cron[3164]: (system) INSECURE MODE (group/other writable) (/etc/crontab)

Corrigir usando o comando

sudo chmod 600 /etc/crontab

e reinicie o serviço

sudo service cron restart
    
por 18.09.2013 / 08:08

Tags