LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-16-2004, 05:24 PM   #1
BlackRabbit
Member
 
Registered: Oct 2003
Distribution: Debian
Posts: 83

Rep: Reputation: 15
crontab problem


Situation: I have 2 identical scripts each doing their thing in their own directory:
/data/dir1/script.sh
/data/dir2/script.sh

Each script works as it should when I execute it manually.

Ik put the following commands in bleh.cron:
15,30,45,0 * * * * /data/dir1/script.sh
15,30,45,0 * * * * /data/dir2/script.sh

After that, I did "crontab bleh.cron", crontab -l gives back both lines of bleh.cron (15,30,45,0 * * * * /data/dir1/script.sh & 15,30,45,0 * * * * /data/dir2/script.sh).
The scripts should be run every quarter of an hour, but the problem is only /data/dir1/script.sh is executed.

What's the problem?
 
Old 06-16-2004, 05:45 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
Some of my gray cells claim that there needs to be a
blank line at the end of a crontab file ... not sure why
they do so, I didn't seen anything to that effect in
the man pages ...



Cheers,
Tink
 
Old 06-16-2004, 05:55 PM   #3
BlackRabbit
Member
 
Registered: Oct 2003
Distribution: Debian
Posts: 83

Original Poster
Rep: Reputation: 15
Well, there is a blank line..

Weird: when changing lines, the script in dir2 stays unexecuted..
(so: (1) is always executed, no matter if its before or after (2) )

I saved bleh.cron in /data/dir1
could this be the problem?
 
Old 06-16-2004, 05:58 PM   #4
Tuttle
Senior Member
 
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,291

Rep: Reputation: 52
are you SURE your snytax is rigth?
 
Old 06-16-2004, 06:01 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
I've just tried what you describe...

Thing is, if I have a blank line at the end of
bleh.cron, and do crontab bleh.cron, the
actual crontab DOESN'T inherit the blank
line. In crontab -e I have to manually add
a line afterwards.



Cheers,
Tink
 
Old 06-16-2004, 06:09 PM   #6
BlackRabbit
Member
 
Registered: Oct 2003
Distribution: Debian
Posts: 83

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Tuttle
are you SURE your snytax is rigth?
Yeah, I can manually execute both scripts (which are identical btw) flawlessly

With crontab -e the blank lines are also included, added some more just to be sure


OW:
test@Jupiter:~$ crontab -e
skipping 1 old session file
reading /var/spool/cron/crontab.6114

Last edited by BlackRabbit; 06-16-2004 at 06:15 PM.
 
Old 06-16-2004, 06:13 PM   #7
Tuttle
Senior Member
 
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,291

Rep: Reputation: 52
Sorry, had to ask. I've stared at simple mistakes for days without noticing!!!

edit: make bz<I>mage! DOH!

Last edited by Tuttle; 06-16-2004 at 06:14 PM.
 
Old 06-17-2004, 03:23 AM   #8
BlackRabbit
Member
 
Registered: Oct 2003
Distribution: Debian
Posts: 83

Original Poster
Rep: Reputation: 15
Hehe

Nobody else with an idea?

I just don't get it: in both lines I use absolute paths, both are correct (e.g.: I can do "less [path]" and it will work) and still only the first one is executed..
 
Old 06-17-2004, 06:59 AM   #9
BlackRabbit
Member
 
Registered: Oct 2003
Distribution: Debian
Posts: 83

Original Poster
Rep: Reputation: 15
I removed the dir1 entry and waited.. Seems like there is _something_ wrong, but I don't know what.

I'll shortly explain what the script does in order for you guys to understand me better:

the script reads a file in the same directory (status.txt) and greps 'n' cuts a few things out of it, puts those tings into variables.
Then I let the script run lynx -dump [URL] , where [URL] is a link to de central status server. The URL contains the variables in the querystring (e.g.: "input.php?a=BlackRabbit&ID=1").
The ID is used like a primary key on the webserver: the corresponding statusinfo is updated on the webserver.
As said, both scripts sit in their own directory, each having their own status.txt for themselves.

When executing the scripts manually, the status is properly updated (1 => 1, 2 => 2) on the central status webserver, with crontab, it's always the first (with ID=1) that is updated..
When I echo the $url variable (in my script), everything is also fine...

Kind of weird

Last edited by BlackRabbit; 06-17-2004 at 07:06 AM.
 
Old 06-17-2004, 07:38 AM   #10
BlackRabbit
Member
 
Registered: Oct 2003
Distribution: Debian
Posts: 83

Original Poster
Rep: Reputation: 15
I think I know what's wrong

Are cronjobs run from the user's homedir? (the one they get to when they log in)
I think so
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Crontab Problem smus Linux - Newbie 4 12-10-2005 08:52 AM
crontab problem provo1234 Linux - General 3 01-21-2005 11:20 AM
Problem with crontab PierrePau Linux - Software 3 06-28-2004 02:34 PM
problem with crontab juanb Linux - Newbie 2 12-16-2003 04:54 AM
crontab problem TomTheNewbie Slackware 1 07-09-2003 07:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:55 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