change cron log level

I’m trying to figure out how to change the cron log level. Looks like by default only show start time of cron jobs. need to also show end time. How do I configure to due this?

Hi and welcome to the Forum :slight_smile:
Consider switching (and future proofing) to systemd services and timers, you will then get a journal entry of when the job started and if it succeeded which show the time stamps.

Do you have an example of the current cron job?

Sorry for the delay, been busy with the prep for school year to start, and the notification email of reply got buried.

One job only runs this command nightly.

rm -f /opt/carsi/spool/*/.spllock

which cleans up some files that our ERP sometime doesn’t auto-delete. I can’t post the actual job per policy here. but is a basic few line job.

You mentions systemd, I don’t know much about that. On HP-UX we use to be able to set the cron log level, and I read some Linux have similar settings. It seems suse doesn’t.

John

[QUOTE=gu_adamski;58370]Sorry for the delay, been busy with the prep for school year to start, and the notification email of reply got buried.

One job only runs this command nightly.

rm -f /opt/carsi/spool/*/.spllock

which cleans up some files that our ERP sometime doesn’t auto-delete. I can’t post the actual job per policy here. but is a basic few line job.

You mentions systemd, I don’t know much about that. On HP-UX we use to be able to set the cron log level, and I read some Linux have similar settings. It seems suse doesn’t.

John[/QUOTE]
Hi John
Look at scripting your command and add the logger command, eg;

#!bin/bash
logger "Starting cleanup of spllock"
rm -f /opt/carsi/spool/*/.spllock
logger "Finished cleanup of spllock"

You will get an entry like;

Aug 27 16:35:56 hostname username[13724]: Starting cleanup of spllock
....
....
Aug 27 16:36:07 hostname username[14035]: Finished cleanup of spllock

Make executable (chmod 0700) and save the file in /etc/cron.daily you can configure the daily time for cron to run, else save the script somewhere eg /usr/locsl/sbin and call the script with time and date in the crontab.

Use the man page for logger to see other options eg perhaps a /var/log/spllock.log file (don’t forget a logrotate file :wink: )

If you just need to cleanup a dir , you can still use the tmpfiles service . For details man 5 tmpfiles.d

The example job was just that an example. The jobs we would like the start/end times have multiple commands can take hours to run. The people that monitor the jobs liked the fact our old OS (HPUX) allowed the start/end times to be logged. And rather than modify a hundred jobs to somehow do this for each job, they wanted to know if a OS level setting could do it, like in HPUX.

Looks like SUSE doesn’t, but other Linux flavors do.

john

I don’t know which Linux does - at least RHEL and SLES don’t.

Another approach is to make each job as a systemd service file ‘Exec=/my/script’ ,Configure logging properly ‘journal,console, syslog,etc’ and then use systemd’ s timers.
That way you can have your jobs properly logging anything you need. You can have debug enabled in your script ‘set -x’ or #!/bin/bash -x’ and you will see any detail in the journal/syslog files.

Don’t forget that Linux is opensource and you can modify it as you wish and even propose features to vendors like Canonical, Red Hat or SuSE (which is not possible with HP-UX)

thanks, not sure what we will do. hard to change when for 20+ years you been doing things one way then your ERP says they’re changes supported OS’s and you have months to switch. Makes for some grumpy people. Linux maybe open source, but the contract with ERP providers says we can’t make changes from standard release, or they will not support us. (and will still have to pay for support whether we get it or not - isn’t that nice of them).

we will get use to Suse at some point.

john

Creation of systemd services to replace existing cron jobs must be supported . After all systemd is the new init - if your systemd.timer is not working properly SUSE will provide support when needed.