Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
07-06-2008, 08:40 AM
|
#1
|
Member
Registered: Apr 2004
Location: India
Distribution: Ubuntu
Posts: 364
Rep:
|
disable cron from logging to syslog
Hi,
I have a cron job that runs every 10 minutes. Problem is that it clutters my /var/log/syslog file. Can someone help me with a way of disabling this logging ?
So far I have tried the following:
1) Redirected the output of the command to /dev/null. (This solved the problem of the output being mailed to me every time)
Code:
0,10,20,30,40,50 * * * * /usr/local/bin/keeponline.sh >> /dev/null 2>&1
2) Edited /etc/syslog.conf and commented out the lines containing 'cron'. This is what the file looks like:
Code:
# /etc/syslog.conf Configuration file for syslogd.
#
# For more information see syslog.conf(5)
# manpage.
#
# First some standard logfiles. Log by facility.
#
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none -/var/log/syslog
#cron.* /var/log/cron.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
#
# Logging for the mail system. Split it up so that
# it is easy to write scripts to parse these files.
#
mail.info -/var/log/mail.info
mail.warn -/var/log/mail.warn
mail.err /var/log/mail.err
# Logging for INN news system
#
news.crit /var/log/news/news.crit
news.err /var/log/news/news.err
news.notice -/var/log/news/news.notice
#
# Some `catch-all' logfiles.
#
*.=debug;\
auth,authpriv.none;\
news.none;mail.none -/var/log/debug
*.=info;*.=notice;*.=warn;\
auth,authpriv.none;\
# cron,daemon.none;\
mail,news.none -/var/log/messages
#
# Emergencies are sent to everybody logged in.
#
*.emerg *
#
# I like to have messages displayed on the console, but only on a virtual
# console I usually leave idle.
#
#daemon,mail.*;\
# news.=crit;news.=err;news.=notice;\
# *.=debug;*.=info;\
# *.=notice;*.=warn /dev/tty8
# The named pipe /dev/xconsole is for the `xconsole' utility. To use it,
# you must invoke `xconsole' with the `-file' option:
#
# $ xconsole -file /dev/xconsole [...]
#
# NOTE: adjust the list below, or you'll go crazy if you have a reasonably
# busy site..
#
daemon.*;mail.*;\
news.err;\
*.=debug;*.=info;\
*.=notice;*.=warn |/dev/xconsole
However, there's entries in my syslog every 10 minutes:
Code:
Jul 6 17:30:01 ranjandesk /USR/SBIN/CRON[13450]: (akudewan) CMD (/usr/local/bin/keeponline.sh >> /dev/null 2>&1)
Jul 6 17:40:01 ranjandesk /USR/SBIN/CRON[13707]: (akudewan) CMD (/usr/local/bin/keeponline.sh >> /dev/null 2>&1)
Jul 6 17:50:01 ranjandesk /USR/SBIN/CRON[13984]: (akudewan) CMD (/usr/local/bin/keeponline.sh >> /dev/null 2>&1)
Can I make this particular cron job not log to syslog?
|
|
|
07-06-2008, 09:54 AM
|
#2
|
LQ Guru
Registered: Jan 2001
Posts: 24,149
|
You need to edit the line that is outputing *.* to your syslog log file:
Code:
*.*;auth,authpriv.none -/var/log/syslog
It was the line above your cron log you already edited. I wouldn't totally comment it out, customize it to log what you want. man syslog.conf and or syslog for more details on logging levels, etc.
|
|
|
07-06-2008, 10:51 AM
|
#3
|
Member
Registered: Apr 2004
Location: India
Distribution: Ubuntu
Posts: 364
Original Poster
Rep:
|
Thanks a million trickykid! I managed to solve the problem simply by changing the *.* line to look like this:
Code:
*.*;auth,authpriv,cron.none -/var/log/syslog
|
|
1 members found this post helpful.
|
07-06-2008, 04:41 PM
|
#4
|
LQ Guru
Registered: Jan 2001
Posts: 24,149
|
Quote:
Originally Posted by akudewan
Thanks a million trickykid! I managed to solve the problem simply by changing the *.* line to look like this:
Code:
*.*;auth,authpriv,cron.none -/var/log/syslog
|
No problem.
|
|
|
07-06-2008, 05:37 PM
|
#5
|
Senior Member
Registered: Jun 2008
Posts: 2,529
Rep:
|
Why not make your keeponline script do its thing in a loop, sleep for N seconds, and then do its thing again?
Then, just start it either manually, or via your startup scripts.
Disabling cron syslog output will end up biting you some time.
|
|
|
07-06-2008, 10:09 PM
|
#6
|
LQ Guru
Registered: Jan 2001
Posts: 24,149
|
Quote:
Originally Posted by Mr. C.
Why not make your keeponline script do its thing in a loop, sleep for N seconds, and then do its thing again?
Then, just start it either manually, or via your startup scripts.
Disabling cron syslog output will end up biting you some time.
|
Well, he could turn the cron logging back on that he initially disabled. I don't like the same thing logging to multiple places, kind of annoying.
|
|
|
07-07-2008, 10:29 AM
|
#7
|
Member
Registered: Apr 2004
Location: India
Distribution: Ubuntu
Posts: 364
Original Poster
Rep:
|
Quote:
Originally Posted by Mr. C.
Why not make your keeponline script do its thing in a loop, sleep for N seconds, and then do its thing again?
Then, just start it either manually, or via your startup scripts.
Disabling cron syslog output will end up biting you some time.
|
Hmm...that makes a lot of sense. I think I'll implement this when I have some free time on my hands.
Thanks for the suggestion.
|
|
|
All times are GMT -5. The time now is 05:16 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|