LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 06-26-2003, 06:38 AM   #1
yannrichet
LQ Newbie
 
Registered: Jun 2003
Posts: 3

Rep: Reputation: 0
[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...

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 (the "sendmail" command in it doesn't seems to produce a mail ! )

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.
 
Old 06-26-2003, 08:27 AM   #2
KDE4me
Member
 
Registered: Apr 2003
Location: Australia
Distribution: RedHat 9.0 / Slackware 9.0/ FreeBSD 4.8 / Solaris 8 x86 / Mandrake 9.0
Posts: 90

Rep: Reputation: 15
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.
 
Old 06-26-2003, 08:29 AM   #3
KDE4me
Member
 
Registered: Apr 2003
Location: Australia
Distribution: RedHat 9.0 / Slackware 9.0/ FreeBSD 4.8 / Solaris 8 x86 / Mandrake 9.0
Posts: 90

Rep: Reputation: 15
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
 
Old 06-26-2003, 08:43 AM   #4
yannrichet
LQ Newbie
 
Registered: Jun 2003
Posts: 3

Original Poster
Rep: Reputation: 0
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
 
Old 06-26-2003, 09:15 AM   #5
KDE4me
Member
 
Registered: Apr 2003
Location: Australia
Distribution: RedHat 9.0 / Slackware 9.0/ FreeBSD 4.8 / Solaris 8 x86 / Mandrake 9.0
Posts: 90

Rep: Reputation: 15
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
 
Old 06-26-2003, 09:57 AM   #6
yannrichet
LQ Newbie
 
Registered: Jun 2003
Posts: 3

Original Poster
Rep: Reputation: 0
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting a cron task in a script Slith(++1) Programming 3 11-21-2005 04:17 AM
How to schedule *interactive* task with at or cron fast_rizwaan Linux - Newbie 4 09-09-2005 06:26 PM
CRON deamon lockup during startup. Dr.Jamescook SUSE / openSUSE 0 11-11-2004 08:56 PM
Cron deamon? eXor Slackware 4 07-02-2003 11:55 AM
cron Deamon DJFauß Linux - General 2 01-22-2002 03:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration