Solved

cron job not writing to the log file

Posted on 2011-03-16
9
639 Views
Last Modified: 2012-06-27
Hi,
I have a question about crontab in CentOS. Two days ago I upgraded my server and a few settings got changed. Now the cron job is writing to the log file. I asked the service provider and they said they will not be able to help me with that. I'm using a VPS.

Please let me know how to enable logging in cron.

Thanks.
0
Comment
Question by:orazen12
  • 4
  • 3
  • 2
9 Comments
 
LVL 3

Expert Comment

by:Abhishek_Chib
ID: 35154155
Hi,

Your question is not cleared.

1. crond is not working ?
2. If it is working then /var/log/cron file not updating ?
3. You schedule some cron but schedule cron not updating the file user specific logs ?

0
 
LVL 3

Expert Comment

by:Abhishek_Chib
ID: 35154164
And also do some basic trouble shooting :

Reference :

http://aplawrence.com/Unixart/crontab_not_running.html

0
 

Author Comment

by:orazen12
ID: 35154219
Sorry for not being clear.
Cron is working. The job is run. What I need is that it should write the same to the log file that it ran which job at which time. The log file is empty even though the job is run.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 3

Expert Comment

by:Abhishek_Chib
ID: 35154299
Hi,

First I will prefer, to do some troubleshooting, please follow URL :

http://aplawrence.com/Unixart/crontab_not_running.html

and finally restart the service, check the disk space include inode
0
 

Author Comment

by:orazen12
ID: 35154613
Well....I did go through it and am not sure what to do from there.

I even restarted the service. It is still not writing to the log file at /var/log/cron (cron being the file name).

0
 
LVL 6

Expert Comment

by:Tomunique
ID: 35156304
check syslog config

in our case: /etc/syslog-ng/syslog-ng.conf

I found these lines on our system:
filter f_cron       { facility(cron); };
#destination cron { file("/var/log/cron"); };
#log { source(src); filter(f_cron); destination(cron); };

you'd want yours uncommneted.
0
 

Accepted Solution

by:
orazen12 earned 0 total points
ID: 35163193
Tomunique
I could not find the syslog file. Sorry I'm new at this. But I got it working by another approach. I had to start the service rsyslog. The service was stopped. The moment I did that it started working. So I used the command

/sbin/service rsyslog start

Thanks.
0
 
LVL 6

Expert Comment

by:Tomunique
ID: 35164800
k, I'm not a linux expert...
but ifthat worked for you... great...
0
 

Author Closing Comment

by:orazen12
ID: 35187543
The service provider told me this solution.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question