[ELDK] crond not working

Germano Barreiro germano.barreiro at gmail.com
Fri Feb 26 16:15:06 CET 2010


Your example did throw some light on the issue, and I'm very grateful
you gave yourself the trouble of making this test and describing it
here.
Basically, the difference is that I was trying to use the system
crontab - /etc/crontab - as I said in my first email. But your example
uses an user crontab, what I tried too and things worked then. Thank
you!

However, by the crond man page:

"
Cron also  searches for /etc/crontab and the files in the directory,
which are in a different format (see crontab(5) ).
"

I checked also the refered man page and couldnt find anything about a
different format - it was a more or less quick look, I admit. However,
I found this:

"
       In this version of cron , /etc/crontab must not be writable by any user
       other  than  root.   No crontab files may be links, or linked to by any
       other file.  No crontab files may be executable, or be writable by  any
       user other than their owner.
"

Well, indeed, my first /etc/crontab was a soft link to a file that is
in a filesystem where I have write permissions. /etc is mounted in a
read only filesystem. But even after changing the /etc/crontab to a
regular file:

root at cbc:/root:# ls -la /etc/crontab
-rw-r--r-- 1 root root 26 Dec 31  1969 /etc/crontab

... things dint work yet. This is not really a problem anymore since I
can use an user crontab for the purpose of my system, and I'm posting
this just as something that can be of general interest.





On Fri, Feb 26, 2010 at 6:59 AM, Wolfgang Denk <wd at denx.de> wrote:
> Dear Germano Barreiro,
>
> In message <681741761002251428x51c780f2oa9d5d10cc1766a46 at mail.gmail.com> you wrote:
>> I checked if the daemon was running through a ps ax | grep cron
>> command. Also tried to execute it by hand with the option -n plus some
>> -x options.
>> On the other side, the script it was trying to execute has execution
>> permissions and, of course, I can execute it manually.
>
> Keep in mind that crond runs with limited PATH settings (normally
> only containing "/bin" and "/usr/bin") - eventually your commands
> cannot be found?
>
>> Assuming that the crond can do its job, it is really weird what is happening.
>
> I just tested this again, and it's working fine for me. Example:
>
> Set up crontab entry:
>
>        -bash-3.2# crontab -l
>        #---------------------------------------------------------------
>        # m  h  D  M  w  cmd
>        #---------------------------------------------------------------
>        */3  *  *  *  *   /tmp/script.sh
>
> Prepare test script:
>
>        -bash-3.2# ls -l /tmp/script.sh
>        -rwxr-xr-x 1 root root 70 Feb 26 10:39 /tmp/script.sh
>        -bash-3.2# cat /tmp/script.sh
>        #!/bin/sh
>        echo ===== Running ===== >>/tmp/logfile
>        date >>/tmp/logfile
>
> Make sure we don't have stale data:
>
>        -bash-3.2# rm -f /tmp/logfile
>
> Start crond:
>
>        -bash-3.2# date
>        Fri Feb 26 10:50:06 CET 2010
>        -bash-3.2# service crond start
>        Starting crond: [  OK  ]
>
> Verify we still don;t have any output:
>
>        -bash-3.2# date
>        Fri Feb 26 10:50:35 CET 2010
>        -bash-3.2# cat /tmp/logfile
>        cat: /tmp/logfile: No such file or directory
>
> Wait a while, then look again:
>
>        -bash-3.2# date
>        Fri Feb 26 10:54:07 CET 2010
>        -bash-3.2# cat /tmp/logfile
>        ===== Running =====
>        Fri Feb 26 10:51:01 CET 2010
>        ===== Running =====
>        Fri Feb 26 10:54:02 CET 2010
>
> I recommend you to check your script again...
>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> Program maintenance is an entropy-increasing process,  and  even  its
> most skilfull execution only delays the subsidence of the system into
> unfixable obsolescence.       - Fred Brooks, "The Mythical Man Month"
>


More information about the eldk mailing list