Results 1 to 9 of 9

Thread: change cron log level

Hybrid View

  1. #1

    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?

  2. Re: change cron log level

    Quote Originally Posted by gu_adamski View Post
    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
    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?
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  3. #3

    Re: change cron log level

    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

  4. Re: change cron log level

    Quote Originally Posted by gu_adamski View Post
    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
    Hi John
    Look at scripting your command and add the logger command, eg;

    Code:
    #!bin/bash
    logger "Starting cleanup of spllock"
    rm -f /opt/carsi/spool/*/.spllock
    logger "Finished cleanup of spllock"
    You will get an entry like;

    Code:
    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 )
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  5. Re: change cron log level

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

  6. #6

    Re: change cron log level

    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

  7. Re: change cron log level

    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)
    Last edited by strahil-nikolov-dxc; 23-Sep-2019 at 15:04.

  8. #8

    Re: change cron log level

    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

  9. Re: change cron log level

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •