LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   [cron][mdk9.1]cron deamon seems to ignore some task... (https://www.linuxquestions.org/questions/linux-newbie-8/%5Bcron%5D%5Bmdk9-1%5Dcron-deamon-seems-to-ignore-some-task-68172/)

yannrichet 06-26-2003 06:38 AM

[cron][mdk9.1]cron deamon seems to ignore some task...
 
hello,

I use mdk 9.1

my /var/spool/cron/root :

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.9672 installed on Fri Jun 13 10:51:14 2003)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
00 07 * * * /root/bin/urpmi.update-system
00 07 * * * /usr/bin/updatedb

a part of my /var/log/cron/info :

Jun 26 07:00:00 a740w010 CROND[30647]: (root) CMD (/usr/bin/updatedb)
Jun 26 07:00:00 a740w010 CROND[30648]: (root) CMD (/root/bin/urpmi.update-system)

my /var/log/cron/error and warning are empty...:D

So, I think everything works, but in fact it seems the script /root/bin/urpmi.update-system (first line of /var/spool/cron/root ) is not launched :confused: (the "sendmail" command in it doesn't seems to produce a mail !:cry: )

my /root/bin/urpmi.update-system :

#!/bin/sh
urpmi.update --all
urpmi --auto-select --auto | sendmail richet

note :
- richet is a classic user
- when I launch /root/bin/urpmi.update-system manually, it works (user richet receives the mail expected)


Does anybody have already found this problem ?

thanks.

KDE4me 06-26-2003 08:27 AM

This is just a stab in the dark but what are the permissions set on the script? Make sure that it's set on executable. Of course this wouldn't explain why it works manually though. If I were you I'd crontab it again and add to send the error to a file because crontab will only find the errors for cron not for the item that it runs i.e.
00 07 * * * /root/bin/urpmi.update-system 1> successful.out 2>error.out
see if that gives you any info.

KDE4me 06-26-2003 08:29 AM

sorry I forgot to add that if you don't want the succesful.out and error.out to be in ./cron specify the full directory path for them

yannrichet 06-26-2003 08:43 AM

here are the results...

::::::::::::::
error.out
::::::::::::::
/root/bin/urpmi.update-system: line 2: urpmi.update: command not found
/root/bin/urpmi.update-system: line 3: urpmi: command not found
/root/bin/urpmi.update-system: line 3: sendmail: command not found
::::::::::::::
successful.out
::::::::::::::

I don't understand anything...
Why these commands are "not found" while I can run it manually ???

note :
-rwxr-xr-x 1 richet richet 74 jun 13 10:08 /root/bin/urpmi.update-system*

thanks

KDE4me 06-26-2003 09:15 AM

My only suggestion from what I can tell would be to tweak the script a bit:

/root/bin/urpmi.update-system :

a)use the backquotes `` (next to ~) - it should force execution into a subshell

#!/bin/sh
`urpmi.update --all`
`urpmi --auto-select --auto | sendmail richet`

or try to specify the full path of the commands you've used: sendmail and urpmi
I'd first try:

$which urpmi
and put the path into the script
and then:
$ which sendmail

which would probably result in something like

#!/bin/sh
`/bin/urpmi.update --all`
`/bin/urpmi --auto-select --auto | /bin/sendmail richet`

run the redirection again 2> 1> and see what happens

I'm not sure how cron get's it's pathname so I merely assume that you have to specify the full directory in the script i.e./bin/.... . This might explain why it works when you run the command in your terminal i.e. your path is in your $HOME/.profile

yannrichet 06-26-2003 09:57 AM

It works !
finally, my urpmi.update-system script is :

#!/bin/sh
/usr/sbin/urpmi.update --all
/usr/sbin/urpmi --auto-select --auto | /usr/sbin/sendmail richet

thanks, and best regards !

Yann


All times are GMT -5. The time now is 11:59 AM.