0

I have been trying to setup a cronjob on CentOS but it doesn't seem to work. I have been deleting the cron's logfile to see all newly created logs and I have been restarting crond but /var/log/conf wasn't getting recreated?

logrotate /etc/logrotate.conf is showing me an error

error: stat of /var/log/cron failed: No such file or directory
Gryu
  • 499
  • 1
  • 6
  • 14
fefe
  • 357
  • 1
  • 8
  • 18

2 Answers2

1

No such file or directory can imply a number of things. The two most common cryptic cases are:

  • You tried to traverse a broken symlink
  • You tried to open a file in a nonexistent directory

Check whether these are the case. It can also happen if your program expects the file to exist when opened and hasn't specified to the operating system that it's OK to create it if it doesn't. You could try something like touch /var/log/cron so it has something to stat; this command will create an empty file there.

Falcon Momot
  • 25,244
  • 15
  • 63
  • 92
  • This may be a result of the syslog daemon not running. It's possible that the log files were not being created due to the daemon being in a stopped state. After (re)starting the service you may find the file is created for you. – Drew Khoury May 11 '13 at 14:40
0

So you still have problems with the cronjob?

Its not great practise to delete log files, if you really want to empty a system log file, better to redirect nothing to it like this:

> /var/log/cron

Sirch
  • 5,785
  • 4
  • 20
  • 36
  • I have been recreating as @Falcon Momot advised touch /var/log/cron and seems to work now. I'm going to retest my cronjob now – fefe Apr 29 '13 at 12:03