From: Lonnie A. <li...@lo...> - 2023-09-28 18:42:51
|
Hi Michael, Looking at the /etc/init.d/crond init script, here [1] If the line "crond" was changed to "crond -L /var/log/crond.log" it would disable syslog and use that file ... but may need rotating if it gets large. If the line "crond" was changed to "crond -L /dev/null" it would disable syslog and disable logging (ie. to /dev/null). BTW, I manually tested both cases to be certain. Lonnie [1] https://github.com/astlinux-project/astlinux/blob/09e87eff8bca82bf4afab8dbe09560737dd80d5c/project/astlinux/target_skeleton/etc/init.d/crond#L38 > On Sep 27, 2023, at 8:01 PM, Michael Knill <mic...@ip...> wrote: > > Hi group > > Replying to this email again. I do understand below but just wondering if there is any way to turn off Cron logging totally or send to a separate log file? > > Regards > Michael Knill > > > From: Lonnie Abelbeck <li...@lo...> > Date: Friday, 31 March 2023 at 1:01 am > To: AstLinux Users Mailing List <ast...@li...> > Subject: Re: [Astlinux-users] Stopping logging of Crontab > > Hi Michael, > > The (busybox) crond daemon has a syslog level setting which defaults to 8, the least verbose log level. So no help there. > > Using the filter for the Status Tab, is a reasonable idea. > > > Personally, when executing shell commands on a regular interval of seconds/minutes, I prefer to use a bash shell script and the sleep builtin. (Using the sleep builtin keeps from spawning a new process whenever 'sleep' is called). > > The simplest example of this is the 'msmtpqueue' bash script [1] > > Basic code setup and loop: > -- > #!/bin/bash > > LOCKFILE="/var/lock/foobar.lock" > > # Robust 'bash' method of creating/testing for a lockfile > if ! ( set -o noclobber; echo "$$" > "$LOCKFILE" ) 2>/dev/null; then > echo "foobar: already running, lockfile \"$LOCKFILE\" exists, process id: $(cat "$LOCKFILE")." > return 9 > fi > > # Load 'sleep' builtin if it exists > if [ -f /usr/lib/bash/sleep ]; then > enable -f /usr/lib/bash/sleep sleep > fi > > #seconds to wait > wait=300 > > trap 'rm -f "$LOCKFILE"; exit $?' INT TERM EXIT > > while true; do > # do stuff > > sleep $wait > done > > rm -f "$LOCKFILE" > trap - INT TERM EXIT > -- > > Look at the actual code [1] for finer details. Another fairly simple example, asterisk-sip-monitor [2] which adds a PID file that can be removed to exit the script. > > Lonnie > > [1] https://github.com/astlinux-project/astlinux/blob/master/package/msmtp/msmtpqueue.sh > > [2] https://github.com/astlinux-project/astlinux/blob/master/package/asterisk/asterisk-sip-monitor > > > > > > > On Mar 29, 2023, at 11:39 PM, Michael Knill <mic...@ip...> wrote: > > > > Short of putting in a filter for the Status Tab, is there any way to stop Crontab logging to Syslog. > > I now have a process that is run every 10 minutes and its annoying that it logs to Syslog each time. > > > > Regards > > > > Michael Knill > > Managing Director > > > > D: +61 2 6189 1360 > > P: +61 2 6140 4656 > > E: mic...@ip... > > W: ipcsolutions.com.au > > > > > > _______________________________________________ > Astlinux-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/astlinux-users > > Donations to support AstLinux are graciously accepted via PayPal to pa...@kr.... > _______________________________________________ > Astlinux-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/astlinux-users > > Donations to support AstLinux are graciously accepted via PayPal to pa...@kr.... |