UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX 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:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old June 2nd, 2004, 05:41 PM
sleepyfrog sleepyfrog is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 4 sleepyfrog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Red face CRON job won't run

I have the following cron:
30 23 * * * kunden/homepages/34/d87200027/htdocs/cgi-bin/mailReminders.pl

The .pl has been tried at 755 and 777
The path has been tried as just /cgi-bin/mailReminders.pl as well

The script works if manually run by the web browser, but I can't get the Cron to do it automatically

Cron is supposed to be supported on the server

The web host hasn't got a clue about what could be wrong as "they just provide the space not programming help"

Is there something obvious I'm missing, or any ideas on what could be stopping it from working?

Many thanks

Reply With Quote
  #2  
Old June 2nd, 2004, 06:06 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,299 jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 1 h 54 m 17 sec
Reputation Power: 760
It looks like you're trying to use the absolute path to the script, but you're not b/c you don't start the command with a forward slash (/). Try /kunden/homepages/... or whatever the complete, absolute path is, but lead with a forward slash.
__________________
# Jeremy

Explain your problem instead of asking how to do what you decided was the solution.

Reply With Quote
  #3  
Old June 2nd, 2004, 07:37 PM
sleepyfrog sleepyfrog is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 4 sleepyfrog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Nope!

This was such an obvious error I hoped it would be the cause - however, have added the '/' and still not working.

The absolute path is correct as my perl programmes are working fine.

????????

Reply With Quote
  #4  
Old June 2nd, 2004, 08:04 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,299 jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 1 h 54 m 17 sec
Reputation Power: 760
Depending on what the script is doing, you may be having some permission problems. Cron usually runs under its own user, so if you're trying to modify a file, the script may be dying b/c it "cron" can't access your file. This would explain why it runs in the web browser, as it's probably getting put through some kind of wrapper to execute the script as you. Check for something like that in your code. If you can't find anything, post what you have and I'll look through it. I haven't used a lot of Perl in a while, but I should still be able to read what's going on.

Reply With Quote
  #5  
Old June 2nd, 2004, 08:43 PM
sleepyfrog sleepyfrog is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 4 sleepyfrog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
The mailreminders.pl does not write to anything - it just emails reminders depending on whether a diary entry to a database is due.

All the text for the emails is contained within the .pl script

Do you know of something simple I can set up to see if it is the Cron that is not working, rather than the .pl script?

Sorry to be a pain but this is the first time I have tried to use this system.

Reply With Quote
  #6  
Old June 4th, 2004, 08:50 AM
sleepyfrog sleepyfrog is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 4 sleepyfrog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Any further help available?

Is there a way to test if a CRON command is running?

Have just been onto the hosts again and hitting a brick wall. The .pl script works fine from the browser command line - but nothing happening with the cron.

I need to find out for definite if it is the .pl script causing the problem or the cron system isn't set up properly by the hosting company

Reply With Quote
  #7  
Old June 4th, 2004, 08:54 AM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,442 Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 h 51 m 47 sec
Reputation Power: 797
Try typing this:
ps -xa | grep crond

and report the output here.
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month

Reply With Quote
  #8  
Old June 4th, 2004, 10:29 AM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 24 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
This is just a guess, did you restart the cron daemon?

kill -HUP

-- Steven

Reply With Quote
  #9  
Old June 4th, 2004, 10:35 AM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 24 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
You might want to tell cron to use a specific user between the weekday-asterisk and the path.

You can also pipe the output somewhere so you can see any error code.

Does this .pl script need to be called from a browser?

Reply With Quote
  #10  
Old August 27th, 2004, 08:53 AM
cmateos cmateos is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 cmateos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Cool

Hi.
I have the same problem.
I try to execute a bash script with CRON and it does not run.
If I execute it manually it works.
Must I add (or overwrite) some variable to environment?
Other cron tasks (scripts more simple) work.
Thank you for answering

César

Reply With Quote
  #11  
Old August 27th, 2004, 09:06 AM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,307 jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 28 m 57 sec
Reputation Power: 48
Try forcing some kind of error log -
Code:
/kunden/homepages/34/d87200027/htdocs/cgi-bin/mailReminders.pl 2>/tmp/mailReminders.log

Chances are good that PATH is not defined correctly for this script to run, or some other env variable is not set correctly. cron does not leave error logs by default.

Reply With Quote
  #12  
Old August 28th, 2004, 02:23 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,083 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 49 m 57 sec
Reputation Power: 9
sleepyfrog
please help yourself, there are tousend threads regarding your
cron probl.
always the same answer: cron has a very LIMITED environment!
MIMIMAL PATH and knows only data from /etc/passwd

Reply With Quote
  #13  
Old August 30th, 2004, 09:20 AM
cmateos cmateos is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 cmateos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
T

Thanks to all for answering me.
Already I solved it.
Solution: put the whole env. n the script.
In order that the possibility will bring of def. and overwrite the environment if it does not work?
Regards.
César

Reply With Quote
  #14  
Old September 9th, 2004, 11:44 AM
andyb1ack andyb1ack is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 60 andyb1ack User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 14 sec
Reputation Power: 4
Hi César,

Rather than setting the environment in the script you can dot the .profile via:
. ~/.profile

This is for the korn shell. Other shells have different hidden files (files starting with a .) in your home directory. You can see these with:
ls -a

Cheers,
Andy

Reply With Quote
  #15  
Old September 9th, 2004, 12:57 PM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,083 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 49 m 57 sec
Reputation Power: 9
hi andyb1ack

no intention to be rude...but

Q1: why do you answer to a solved thread?
Q2: why do you give imprecise answers ?

the ~ in ~/.profile
is 100% an invention of mr. korn (copied from csh)
and the .profile
is 100% an invention of mr. bourne (~197[3-8])

sure the statement: dot filename is 100% correct
for sh, ksh, bash ... other
csh can it better

sleepyfrog:

hast du schon mal 'man cmd-name' probiert... umwerfend
was alles rauskommt bei: man cron sh ksh
es ist sicher nicht meine aufgabe, will auch nicht beleidigend
wirken ... 'wach auf'

Reply With Quote