Results 1 to 7 of 7

Thread: Location of Crontab Log

  1. #1

    Default Location of Crontab Log

    Guys,

    I cant seem to find the location of the crontab(/etc/crontab) log ?
    There is no /var/log/messages ...

    This is a 15.1 box.

    Thanks,
    PLMarco

  2. #2

    Default Re: Location of Crontab Log

    Note - the script runs fine from the command line when executed manually. I just need to see what is the issue when its run from
    /etc/crontab/

    Quote Originally Posted by marcopl View Post
    Guys,

    I cant seem to find the location of the crontab(/etc/crontab) log ?
    There is no /var/log/messages ...

    This is a 15.1 box.

    Thanks,
    PLMarco

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    26,719

    Default Re: Location of Crontab Log

    I am not sure that error output (going to stdout) will go to any logging. It will be mailed to the owner of the crontab.

    In any case, a few hints for "it runs when done from the terminal, but not from cron".
    Use absolute pathes, when running from the terminal you are in a working directory, your cron job will not know that working directory. Thus either do a
    Code:
    cd the-working-directory
    at the begin of your cron command and then work relative to that, ot use absolute pahhes only.

    Other envirinment variables may also not be set to what you expect (your expectation might be that you think that all that is in your terminal session is autmaticaly available when your background cron job starts, this is not the case). There is a lot about environment variables in
    Code:
    man 5 crontab
    Last edited by hcvv; 02-Jul-2020 at 03:23.
    Henk van Velden

  4. #4
    Join Date
    Jan 2017
    Location
    Nürnberg, Germany
    Posts
    276

    Default Re: Location of Crontab Log

    openSUSE lets systemd/journald do the logging. For example, try
    Code:
    journalctl --no-hostname --output=short-precise | grep -i cron
    (Depending on your permissions, you may have to prepend a »sudo«: »sudo journalctl«...)

    If you like, let us know the last few dozen lines of output or so.

  5. #5

    Default Re: Location of Crontab Log

    Thanks guys ... Looks like there is no more /var/log/messages etc.

    These logs ( due to systemd ) are being handled by the journald daemon.

    To look at cron and see if the file is being executed, I used

    " journalctl -u cron.service -f "

    Thanx.

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    26,719

    Default Re: Location of Crontab Log

    I hope the log helps you in finding what goes wrong.

    BTW, when you come back in the future:

    There is an important, but not easy to find feature on the forums.

    Please in the future use CODE tags around copied/pasted computer text in a post. It is the # button in the tool bar of the post editor. When applicable copy/paste complete, that is including the prompt, the command, the output and the next prompt.

    An example is here: Using CODE tags Around your paste.
    Henk van Velden

  7. #7
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    12,425
    Blog Entries
    2

    Default Re: Location of Crontab Log

    Quote Originally Posted by marcopl View Post
    Thanks guys ... Looks like there is no more /var/log/messages etc.

    These logs ( due to systemd ) are being handled by the journald daemon.

    To look at cron and see if the file is being executed, I used

    " journalctl -u cron.service -f "

    Thanx.
    Yes, that's absolutely correct.
    All distros that run systemd instead of the legacy SysVinit now log everything in a single log database accessible with the "journalctl" command. There are numerous advantages to doing this.

    But, be aware also that a number of apps and services are also no longer managed by cron although cron will likely remain as an option for years to come. Instead, there is a "timer" service that can be used for same/similar purposes.

    Either way though, logging will be to the journal.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Posting Permissions

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