Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Hi, Im new to linux and currently using Ubuntu 10.4LT. I have been learning the basics of crontab and have managed to run a few dummy taks, however through this ...
  1. #1
    Just Joined!
    Join Date
    Oct 2010
    Posts
    38

    Crontab log

    Hi,

    Im new to linux and currently using Ubuntu 10.4LT.

    I have been learning the basics of crontab and have managed to run a few dummy taks, however through this process a number of tasks did not work.

    This has brought me to the point of thinking,,.. isn't there a crontab log?

    I have tried to search for it but nothing appears to be found.

    Any help or links to info would be appriciated

    Cheers
    Matt

  2. #2
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,095
    Hello and welcome to the forums!

    Take a look in /var/log for the various log files.
    oz

    new members/users: read this first | new member faq
    no private messages requesting computer support - post them on the forums!
    please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.

  3. #3
    Just Joined!
    Join Date
    Oct 2010
    Posts
    38
    Hi the following files are in that directory, but there doesnt seem to be anything relating to crontab...

    apparmor dmesg kern.log.1 speech-dispatcher
    apt dmesg.0 lastlog syslog
    auth.log dmesg.1.gz lpr.log syslog.1
    auth.log.1 dmesg.2.gz lpr.log.1 syslog.2.gz
    boot dmesg.3.gz mail.err syslog.3.gz
    boot.log dmesg.4.gz mail.info udev
    bootstrap.log dpkg.log mail.log ufw.log
    btmp faillog mail.warn unattended-upgrades
    ConsoleKit fontconfig.log messages user.log
    cups fsck messages.1 user.log.1
    daemon.log gdm news wtmp
    daemon.log.1 installer pm-powersave.log Xorg.0.log
    debug jockey.log pm-suspend.log Xorg.0.log.old
    debug.1 jockey.log.1 pycentral.log Xorg.1.log
    dist-upgrade kern.log samba Xorg.1.log.old
    matt@mattmini:/var/log$

  4. #4
    Trusted Penguin elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    2,298
    I believe that Ubuntu will log cron activity in /var/log/syslog
    If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)


    My new blog. It's probably not as good as I think it is.

  5. #5
    Just Joined!
    Join Date
    Oct 2010
    Posts
    38
    That file shows the following:

    Oct 31 15:49:15 mattmini anacron[955]: Normal exit (1 job run)
    Oct 31 15:56:04 mattmini crontab[2054]: (matt) BEGIN EDIT (matt)
    Oct 31 15:57:18 mattmini crontab[2054]: (matt) REPLACE (matt)
    Oct 31 15:57:18 mattmini crontab[2054]: (matt) END EDIT (matt)
    Oct 31 15:58:01 mattmini cron[958]: (matt) RELOAD (crontabs/matt)
    Oct 31 16:06:23 mattmini crontab[2127]: (matt) LIST (matt)


    however it doesnt show any tasks that were scheduled in crontab that failed (do to errors in shell scripts)....

    how can i find this info in a log?

    Thanks

  6. #6
    Trusted Penguin elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    2,298
    I think you have to redirect stderr to a file for the cron job
    If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)


    My new blog. It's probably not as good as I think it is.

  7. #7
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    The crontab log will only show when the script ran, it won't show any errors that occured within the script. If you didn't redirect stderr to a file and there were errors then crond should have e-mail them to your linux account. Did you check your mail for your linux account?

    # mail

  8. #8
    Just Joined!
    Join Date
    Oct 2010
    Posts
    38
    O.K thanks, im really new to linux, .... could you explain or point me in the way of some info on the following...

    stderr and how to configure linux mail?

    when i enter 'mail' I get the following output:

    matt@mattmini:~$ mail
    The program 'mail' can be found in the following packages:
    * heirloom-mailx
    * mailutils
    Try: sudo apt-get install <selected package>
    matt@mattmini:~$

  9. #9
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    You are using a linux shell called bash. To get help on bash type:

    # man bash

    The section you’re currently interested in is Redirection so search for it by typing:

    /Redirection

    Linux determines where input comes from and output goes to with file descriptors. They are:

    0 or stdin which is the standard input
    1 or stdout which is the standard output
    2 or stderr which is the standard error. That’s where error messages are printed.

    By default all three point to your terminal.
    It would help if you posted your crontab entry. You probably have your script in crontab as:

    /path/to/script > /path/to/log

    To get error messages printed in the log as well you need to change it to:

    /path/to/script > /path/to/log 2>&1

    Now I don’t use Ubuntu but you can try what the error message says to installed those packages. If you are not logged in as root:

    # sudo apt-get install heirloom-mailx
    # sudo apt-get install mailutils

    If you are logged in as root leave off the sudo.

    Hope that helps.

  10. #10
    Just Joined!
    Join Date
    Oct 2010
    Posts
    38
    Ok thanks, much appriciated

Page 1 of 2 1 2 LastLast

Posting Permissions

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