Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsLinux Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 12th, 2003, 03:30 PM
scream scream is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 451 scream User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 31 m 13 sec
Reputation Power: 9
Send a message via ICQ to scream
in /etc/crontab, but not running

I wanted to run a perl script at one minute intervals so I added the appropriate line to /etc/crontab. It isn't being run. Is there anything else I need to do to make it work?

Thanks!

Reply With Quote
  #2  
Old June 12th, 2003, 04:07 PM
christo's Avatar
christo christo is offline
Introspective
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Nov 2001
Location: London, UK
Posts: 3,297 christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 1 h 10 m 50 sec
Reputation Power: 104
Send a message via ICQ to christo Send a message via Yahoo to christo
have you tried running

crontab -e

you can then edit the crontab file in vi (or your default editor), save it and close it, then you're away.

if you exit crontabs manually, you must always then run the crontab command against that file. I'm not familiar with your setup. I'm used to seeing crontab files in /var/spool/cron/crontabs/

try the -e thing and if that doesn't work post back with your crontab entry. There are other things we could try.


christo

Reply With Quote
  #3  
Old June 12th, 2003, 11:31 PM
scream scream is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 451 scream User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 31 m 13 sec
Reputation Power: 9
Send a message via ICQ to scream
I went ahead and made a file, cron.txt, with these contents:

* * * * * /usr/local/vhosts/affiliatefreebies.com/cgi-bin/oxmx_task.pl >/home/cronoutput.txt

Then I entered 'crontab cron.txt' and now when I do 'crontab -l' I get:

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (cron.txt installed on Thu Jun 12 21:36:25 2003)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
* * * * * /usr/local/vhosts/affiliatefreebies.com/cgi-bin/oxmx_task.pl >/home/cronoutput.txt

Now it runs every minute.

Last edited by scream : June 12th, 2003 at 11:46 PM.

Reply With Quote
  #4  
Old June 12th, 2003, 11:49 PM
scream scream is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 451 scream User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 31 m 13 sec
Reputation Power: 9
Send a message via ICQ to scream
I am seeing a problem though with the output in that cronoutput.txt file. The perl script I am running references objects like Something::Else and also uses relative paths. I do not think cron is running the script like it's in the directory it is actually in though, because it generates errors. However, when I just 'cd' into the directory and run the script, it works fine.

Any ideas on that problem?

Reply With Quote
  #5  
Old June 13th, 2003, 04:24 AM
christo's Avatar
christo christo is offline
Introspective
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Nov 2001
Location: London, UK
Posts: 3,297 christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 1 h 10 m 50 sec
Reputation Power: 104
Send a message via ICQ to christo Send a message via Yahoo to christo
edit your crontab line to say:

* * * * * /usr/local/vhosts/affiliatefreebies.com/cgi-bin/oxmx_task.pl >/home/cronoutput.txt 2>~/errorfile.txt

any cron errors will then be added to the errorfile.txt in your home area.

However, it sounds more like your PERL sript is being bad - and I can't comment on that without seeing (at least par of) it


christo

Reply With Quote
  #6  
Old June 13th, 2003, 10:22 AM
scream scream is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 451 scream User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 31 m 13 sec
Reputation Power: 9
Send a message via ICQ to scream
I forget exactly what it said, but I read something last night that explained how when cron runs a script, it runs it as if it was being run from the same directory the cron program is in. That means any relative type paths you have in a Perl script will cause it to not work. I modified the Perl script and now it runs from any directory.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > in /etc/crontab, but not running


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT