From: Michael K. <li...@mk...> - 2023-09-30 10:37:45
|
Hi, I find that logging also sometimes annoying (so I filter it out for the status tab. What about an additional "rc.conf" variable (default is NO): CRON_LOG_ERRORS_ONLY=yes > Am 30.09.2023 um 03:53 schrieb Lonnie Abelbeck <li...@lo...>: > > Hi Michael, > > Yes, "building our own image" is the correct way to tweak this. :-) > >> • Is it ok to do this? > > Not in general, but in this specific case it is probably fine. > > If you do the 'sed -i ...' as you stated, you are no longer using the read-only base image '/mnt/asturo/etc/init.d/crond' file, instead you are creating an edited writable '/mnt/asturw/etc/init.d/crond' overlay file. This will work as long as any future base image /etc/init.d/crond file does not have important changes your edited copy would not contain. > > The good news for this specific file, it was last changed on "Nov 2, 2015" and is probably not likely to change in the near future. As such, your 'sed -i ...' may be a useable fix until you are building our own image. > > Understand that when the day comes and you build an image with the fix, you would need to remove the '/mnt/asturw/etc/init.d/crond' file to see the read-only base image version. > >> • Will the changes disappear after an upgrade? > > The newly created/edited '/mnt/asturw/etc/init.d/crond' file will be used after any upgrade. > > Lonnie > >> On Sep 29, 2023, at 7:44 PM, Michael Knill <mic...@ip...> wrote: >> >> Hi Lonnie >> >> Moving this to the developer list. >> So as part of our upgrade we will run ‘sed -i 's/^ crond$/ crond -L \/dev\/null/g' /etc/init.d/crond’ which seems to work fine. >> So my questions are: >> • Is it ok to do this? >> • Will the changes disappear after an upgrade? >> >> We have decided that moving forward (timeframe unknown) we will be forking the repository and building our own image (finally you say!). >> We had toyed with the idea of completely rebuilding the system on standard platforms but now want to continue with Astlinux because of its reliability and small footprint. >> As such, the above will be unnecessary eventually. >> >> Regards >> Michael Knill >> >> >> From: Lonnie Abelbeck <li...@lo...> >> Date: Friday, 29 September 2023 at 4:43 am >> To: AstLinux Users Mailing List <ast...@li...> >> Subject: Re: [Astlinux-users] Stopping logging of Crontab >> >> 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 Michael http://www.mksolutions.info |