Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
You can check the mail of the user (that one accessed by the mail command). Usually logs are sent there, unless you specify a different user or address with the MAILTO variable (or assign an empty string to disable logs).
Edit: you can try also to look at /var/log/maillog (if it exists). Once I had a similar problem with sendmail and the error message from the mail server was
Code:
Domain of sender address user@host does not exist
I solved by adding option -f to the sendmail command.
Last edited by colucix; 12-04-2007 at 04:24 AM.
Reason: adding more info
after the cron is ran, /tmp/my_alert_test.log is not created
Quote:
Originally Posted by yusufs
Cron is working fine..
You are not giving me consistent information. How did you determine that cron is working when the test I asked you do to to see if it is working showed that it is not?
Quote:
Originally Posted by yusufs
where i can see the cronjob logs of the user
It depends on which cron daemon your system is using, how it is configured and, and how syslog is configured. This is distro specific, so I cannot say for your machine with certainty. It is not even certain that cron jobs are logged on a job-by-job basis. This is the reason I asked you to do the test - to see if cron is running jobs for you - this method doesn't require any knowledge of your system's cron daemon configuration.
Last edited by matthewg42; 12-04-2007 at 04:44 AM.
Reason: oop, double negative
On Debain Etch and Ubuntu 7.10 systems in default configurations cron job logging is done to /var/log/syslog. You can find the jobs for a specific user like this:
Code:
grep CRON /var/log/syslog |grep username
...of course substituting username for the one you are interested in. You will only be able to run this command if you are in the group syslog or are root on the system.
On Debain Etch and Ubuntu 7.10 systems in default configurations cron job logging is done to /var/log/syslog. You can find the jobs for a specific user like this:
Code:
grep CRON /var/log/syslog |grep username
...of course substituting username for the one you are interested in. You will only be able to run this command if you are in the group syslog or are root on the system.
If you use another distro, I don't know.
mathew,
Thanks for your patience and answers..cron is executing am getting the following mail :
From oracrp@oracle.ali.com.kw Tue Dec 4 14:34:01 2007
Return-Path: <oracrp@oracle.ali.com.kw>
Received: from oracle.ali.com.kw (localhost.localdomain [127.0.0.1])
by oracle.ali.com.kw (8.13.1/8.13.1) with ESMTP id lB4BY1CI005169
for <oracrp@oracle.ali.com.kw>; Tue, 4 Dec 2007 14:34:01 +0300
Received: (from oracrp@localhost)
by oracle.ali.com.kw (8.13.1/8.13.1/Submit) id lB4BY1it005164;
Tue, 4 Dec 2007 14:34:01 +0300
Date: Tue, 4 Dec 2007 14:34:01 +0300
Message-Id: <200712041134.lB4BY1it005164@oracle.ali.com.kw>
From: root@oracle.ali.com.kw (Cron Daemon)
To: oracrp@oracle.ali.com.kw
Subject: Cron <oracrp@oracle> /home/oracrp/test/test.sh
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/oracrp>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=oracrp>
X-Cron-Env: <USER=oracrp>
/bin/sh: /home/oracrp/test/test.sh: Permission denied
You have mail in /var/spool/mail/oracrp
Hmm, strange. This permission denied message is the heart of the problem.
OK, please execute these commands and paste the output:
Code:
ls -l /bin/bash
ls -l /home/oracrp/test/test.sh
mount |grep $(df -k /home/oracrp/test |awk 'NR==2 { print $1 }')
df -k /tmp
ls -ld /tmp
A short explanation of what I am looking for with these commands:
The first is to see the permissions and location of the bash executable (which /bin/sh is a link to as determined from previous posts)
I want to double check the permissions and ownership of the script file, and make sure the path is correct.
I want to check the mount flags for the directory where the script is located, this time explicitly with the path seen in the email (that's the mount command)
The test script is making a file in /tmp - lets be sure there is disk space free (df)
In case something very weird is happening, your /tmp directory should be writable, so the last command is there just to verify this.
Hmm, strange. This permission denied message is the heart of the problem.
OK, please execute these commands and paste the output:
Code:
ls -l /bin/bash
ls -l /home/oracrp/test/test.sh
mount |grep $(df -k /home/oracrp/test |awk 'NR==2 { print $1 }')
df -k /tmp
ls -ld /tmp
A short explanation of what I am looking for with these commands:
The first is to see the permissions and location of the bash executable (which /bin/sh is a link to as determined from previous posts)
I want to double check the permissions and ownership of the script file, and make sure the path is correct.
I want to check the mount flags for the directory where the script is located, this time explicitly with the path seen in the email (that's the mount command)
The test script is making a file in /tmp - lets be sure there is disk space free (df)
In case something very weird is happening, your /tmp directory should be writable, so the last command is there just to verify this.
Mathew, Thanks .. here it is :
[oracrp@oracle test]$ ls -l /bin/bash
-rwxr-xr-x 1 root root 616248 Apr 12 2006 /bin/bash
[oracrp@oracle test]$ ls -l /home/oracrp/test/test.sh
-rwxr-xr-x 1 oracrp dba 47 Dec 4 15:15 /home/oracrp/test/test.sh
[oracrp@oracle test]$ mount |grep $(df -k /home/oracrp/test |awk 'NR==2 { print $1 }')
/dev/cciss/c0d0p1 on / type ext3 (rw)
[oracrp@oracle test]$ df -k /tmp
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/cciss/c0d0p1 25199660 7916216 16003348 34% /
[oracrp@oracle test]$ ls -ld /tmp
drwxrwxrwt 26 root root 4096 Dec 4 16:18 /tmp
This is really strange. The command works from the command line but you get the permission denied from cron... I am unable to understand it. I am completely out of ideas...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.