3

I have following 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

I restarted the service using sudo service cron restart but the file does not appear. So I checked the log file to see the issue.

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)

I was expecting that the log file would either show that it run the command or the error it encountered. Why does it print neither success nor error?

8

Please notice that the file /etc/crontab has wrong permissions, that makes cron to ignore the file and not run the tasks inside of that file:

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

Fix it using the command

sudo chmod 600 /etc/crontab

and restart the service

sudo service cron restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.