derekperrin / rt-n56u

Automatically exported from code.google.com/p/rt-n56u
0 stars 0 forks source link

Unable to suppress or disable cron logging #1327

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. opkg install cron (will install cron in /opt)
2. set correct user in /opt/etc/crontab for cron to work correctly
3. /opt/etc/init.d/S10cron (will start cron daemon)
4. /tmp/syslog.log will now start to fill up with something like:

Sep  3 20:30:01 cron[3647]: (admin) CMD (/opt/bin/run-parts 
/opt/etc/cron.1min^I)
Sep  3 20:30:01 cron[3648]: (admin) CMD (/opt/bin/run-parts 
/opt/etc/cron.5mins^I)

5. there is no way get rid of these messages like editing /etc/syslog.conf or 
using an argument to cron for disabling logging

What is the expected output? What do you see instead?

I would like some way to suppress or disable cron logging or optionally only 
logging errors.

What version of the product are you using? On what operating system?

3.0.3.8-080

Original issue reported on code.google.com by wolle...@gmail.com on 3 Sep 2014 at 8:00

GoogleCodeExporter commented 9 years ago
Cron daemon compiled to firmware. What for have you installed it from 
Entware?.. =)

See example script in wiki 
https://code.google.com/p/rt-n56u/wiki/CommonTips?wl=en#Using_the_built-in_sched
uler_%28crond%29

Original comment by d...@soulblader.com on 3 Sep 2014 at 10:06

GoogleCodeExporter commented 9 years ago
Thanks for you reply. Yes, I know cron is part of the firmware, but the cron 
jobs I want to run are all placed in /opt and they should only be run when /opt 
is mounted. I think the most clean solution would be to have cron be part of 
/opt instead of using the built-in cron to schedule jobs that may not exist 
because /opt is not mounted. If there is no way to get rid of the massive 
amount of cron logs with the entware cron, I will consider switching to the 
firmware cron. But I hope there is a solution somehow.

Original comment by wolle...@gmail.com on 4 Sep 2014 at 7:24

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I can't agree with you. Applications compiled to the firmware require less 
sources to run. You can place all jobs to /opt or any other place and check if 
it exists - smth. like:
[ -x /opt/etc/cron.d/somesctipt.sh ] && opt/etc/cron.d/somesctipt.sh

Anyway loglevel is being controlled at daemon start. 
crond [ -l N ] [ -L /some/path/to/cron.log ]
where N is log level, 0 is the most verbose. Try to set it to 8-9.
-L can be used to write to separate file (by default it writes to syslog)

Original comment by d...@soulblader.com on 4 Sep 2014 at 12:11

GoogleCodeExporter commented 9 years ago
Just looked at the package. It seems you can put these parameters to 
/opt/etc/init.d/S10cron in ARGS="-l 8 ...."

Original comment by d...@soulblader.com on 4 Sep 2014 at 12:25

GoogleCodeExporter commented 9 years ago
Again, thanks for your reply. By "clean solution" I mean a self-contained and 
fully configured solution on the USB flash. If everything is set up in /opt, 
then the USB flash will work on any (compatible) router or if the router is 
somehow factory reset. Then there is no need to alter nvram or anything else on 
the router.

I agree that using the firmware cron a simple file check can be used to check 
whether /opt is mounted. If there is no solution to my problem using the 
entware cron then this is what I will do.

I already looked into cron options, but unfortunately the entware cron (opkg 
install cron) does only support these options:

usage:  /opt/sbin/cron [-n] [-x [ext,sch,proc,pars,load,misc,test,bit]]

Do you know of another entware cron package that supports the -l option?

Original comment by wolle...@gmail.com on 4 Sep 2014 at 4:15

GoogleCodeExporter commented 9 years ago
I see now... I call it "as portable as possible".
Maybe there is crond as a part of busybox package.
if so it can be run with /opt/bin/busybox crond [options]
or create symlink to crond from busybox

Original comment by d...@soulblader.com on 4 Sep 2014 at 7:59

GoogleCodeExporter commented 9 years ago
I finally found a solution to "as portable as possible" without spamming 
syslog. Here is what I did:

1. made a copy of /opt/etc/init.d/S10cron (from the enware version) to S10crond
2. added "ln -sf /opt/etc/crontab /var/spool/cron/crontabs/admin" to S10crond 
as second line
3. set "ARGS="-l 9" in S10crond
4. opkg remove cron (remove the entware version of cron as there is no way to 
stop the spamming)
5. made a /opt/etc/crontab with my cron jobs

Now I am able to do "/opt/etc/init.d/S10crond start" and everything works as 
expected using the BusyBox crond. Also when the router is reset.

The above solution does not need any changes to nvram, so it works by just 
plugging in the USB flash.

Thanks for the help.
3. made a 

Original comment by wolle...@gmail.com on 5 Sep 2014 at 10:05