Quantcast
Viewing latest article 27
Browse Latest Browse All 48

Answer by allaptr for Why crontab scripts are not working?

I was writing an install shell script that creates another script to purge old transaction data from a database. As a part of the task it had to configure daily cron job to run at an arbitrary time, when the database load was low.

I created a file mycronjob with cron schedule, username & the command and copied it to the /etc/cron.d directory. My two gotchas:

  1. mycronjob file had to be owned by root to run
  2. I had to set permissions of the file to 644 - 664 would not run.

A permission problem will appear in /var/log/syslog as something similar to:

Apr 24 18:30:01 ip-11-22-33-44 cron[40980]: (*system*) INSECURE MODE (group/other writable) (/etc/crontab)Apr 24 18:30:01 ip-11-22-33-44 cron[40980]: (*system*) INSECURE MODE (group/other writable) (/etc/cron.d/user)

The first line refers to /etc/crontab file and the later to a file I placed under /etc/cront.d.


Viewing latest article 27
Browse Latest Browse All 48

Trending Articles