SunQuest
           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:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old January 25th, 2005, 08:48 AM
Yeago Yeago is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 39 Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 h 12 m 29 sec
Reputation Power: 15
Crontab not working

Here

crontab -e:
30 18 * * * php bookproxy/followup.php
30 18 * * * php bookproxy/expire_needers.php

Well? Those scripts aren't executing at 6 30 PM or ever.

Reply With Quote
  #2  
Old January 25th, 2005, 08:59 AM
vgersh99 vgersh99 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 47 vgersh99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 Days 5 h 36 m 43 sec
Reputation Power: 4
Send a message via AIM to vgersh99 Send a message via MSN to vgersh99 Send a message via Yahoo to vgersh99
Quote:
Originally Posted by Yeago
Here

crontab -e:
30 18 * * * php bookproxy/followup.php
30 18 * * * php bookproxy/expire_needers.php

Well? Those scripts aren't executing at 6 30 PM or ever.



doing 'man crontab' yields:
Quote:
The shell is invoked from your $HOME directory with an arg0
of sh. Users who desire to have their .profile executed must
explicitly do so in the crontab file. cron supplies a
default environment for every shell, defining HOME, LOGNAME,
SHELL(=/bin/sh), TZ, and PATH. The default PATH for user
cron jobs is /usr/bin; while root cron jobs default to
/usr/sbin:/usr/bin. The default PATH can be set in
/etc/default/cron; see cron(1M).

If you do not redirect the standard output and standard
error of your commands, any generated output or errors will
be mailed to you.


check your path(s) [both php and its arguments] are accessible from cron. If not provide ABSOLUTE pathnames and/or "source" your profile.

Reply With Quote
  #3  
Old January 25th, 2005, 09:06 AM
Yeago Yeago is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 39 Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 h 12 m 29 sec
Reputation Power: 15
Quote:
Originally Posted by vgersh99
doing 'man crontab' yields:


check your path(s) [both php and its arguments] are accessible from cron. If not provide ABSOLUTE pathnames and/or "source" your profile.


Hello and thank you for replying. I read the man page but

Echoing $HOME gives me the existing directory, which I am able to execute PHP from the shell. Echoing $PATH results:
/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/local/msql/bin:/usr/local/mysql-3.21.29-gamma/bin:/usr/games:.

I assumed that since I was able to execute PHP from my home directory, cron would be able to. Any idea?

Reply With Quote
  #4  
Old January 25th, 2005, 09:16 AM
vgersh99 vgersh99 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 47 vgersh99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 Days 5 h 36 m 43 sec
Reputation Power: 4
Send a message via AIM to vgersh99 Send a message via MSN to vgersh99 Send a message via Yahoo to vgersh99
Quote:
Originally Posted by Yeago
Hello and thank you for replying. I read the man page but

Echoing $HOME gives me the existing directory, which I am able to execute PHP from the shell. Echoing $PATH results:
/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/local/msql/bin:/usr/local/mysql-3.21.29-gamma/bin:/usr/games:.

I assumed that since I was able to execute PHP from my home directory, cron would be able to. Any idea?


you executed 'php' from the shell prompt. cron's PATH is different

also 'bookproxy/followup.php' and 'bookproxy/expire_needers.php' are RELATIVE paths. Relative to what?

I'd consider supply ABSOLUTE pathnames anywhere in cron AND/OR explicitely "sourcing" your user "profile" from cron as well. Something like this - with mnemonic pathnames:

Quote:
30 18 * * * [ -f $HOME/.profile ] && . $HOME/.profile && /path2php/php /path2book/bookproxy/followup.php

Reply With Quote
  #5  
Old January 25th, 2005, 09:24 AM
Yeago Yeago is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 39 Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 h 12 m 29 sec
Reputation Power: 15
Quote:
Originally Posted by vgersh99
you executed 'php' from the shell prompt. cron's PATH is different

also 'bookproxy/followup.php' and 'bookproxy/expire_needers.php' are RELATIVE paths. Relative to what?

I'd consider supply ABSOLUTE pathnames anywhere in cron AND/OR explicitely "sourcing" your user "profile" from cron as well. Something like this - with mnemonic pathnames:


Thank you for the example but I have some questions. Firstly, I do not have .profile, at least not in the home directory. What should be in there, to be sourced?

The paths are relative to $HOME. Is this neccessary to put before the relative paths of those .php docs?

Reply With Quote
  #6  
Old January 25th, 2005, 09:42 AM
vgersh99 vgersh99 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 47 vgersh99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 Days 5 h 36 m 43 sec
Reputation Power: 4
Send a message via AIM to vgersh99 Send a message via MSN to vgersh99 Send a message via Yahoo to vgersh99
Quote:
Originally Posted by Yeago
Thank you for the example but I have some questions. Firstly, I do not have .profile, at least not in the home directory. What should be in there, to be sourced?

what shell are you using? csh/tcsh/bash???
do you have '.cshrc'?

these are the shell 'startup' files that set your environment.

Quote:
Originally Posted by Yeago
The paths are relative to $HOME. Is this neccessary to put before the relative paths of those .php docs?


yes.

try debugging your cron entry like so:
Code:
30 18 * * * [ -f $HOME/.profile ] && . $HOME/.profile && /path2php/php /path2book/bookproxy/followup.php > /tmp/cron.log 2>&1


check '/tmp/cron.log' AFTER the cron entry is to be executed.

Reply With Quote
  #7  
Old January 25th, 2005, 10:02 AM
Yeago Yeago is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 39 Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 h 12 m 29 sec
Reputation Power: 15
Crontab now contains:
Quote:
58 10 * * * [ -f $HOME/.bash_profile ] && . $HOME/.bash_profile && /usr/local/bin/php $HOME/bookproxy/followup.php > $HOME/cron.log 2>&1


Yet at 10:58 nothing happened (no output to log). Checked the system time with 'date' just to make sure.

Reply With Quote
  #8  
Old January 25th, 2005, 10:15 AM
vgersh99 vgersh99 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 47 vgersh99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 Days 5 h 36 m 43 sec
Reputation Power: 4
Send a message via AIM to vgersh99 Send a message via MSN to vgersh99 Send a message via Yahoo to vgersh99
wondering if ANYTHING gets executed from your cron.

debug it one step at the time:

58 10 * * * /bin/ls $HOME > /tmp/cron

then try:
58 10 * * * [ -f $HOME/.bash_profile ] && $HOME/.bash_profile && /bin/ls $HOME > /tmp/cron

also read 'man crontab':

Quote:
crontab Access Control
Users: Access to crontab is allowed:

o if the user's name appears in /etc/cron.d/cron.allow.

o if /etc/cron.d/cron.allow does not exist and the
user's name is not in /etc/cron.d/cron.deny.

Users: Access to crontab is denied:

o if /etc/cron.d/cron.allow exists and the user's name
is not in it.

o if /etc/cron.d/cron.allow does not exist and user's
name is in /etc/cron.d/cron.deny.

o if neither file exists.

Note that the rules for allow and deny apply to root only if
the allow/deny files exist.

The allow/deny files consist of one user name per line.

Reply With Quote
  #9  
Old January 25th, 2005, 10:31 AM
Yeago Yeago is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 39 Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level)Yeago User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 h 12 m 29 sec
Reputation Power: 15
Quote:
Originally Posted by vgersh99
wondering if ANYTHING gets executed from your cron.

debug it one step at the time:

58 10 * * * /bin/ls $HOME > /tmp/cron

then try:
58 10 * * * [ -f $HOME/.bash_profile ] && $HOME/.bash_profile && /bin/ls $HOME > /tmp/cron

also read 'man crontab':


No response. I am going to mail the sysadmin. Will let you know if that doesn't fix things, thank you very much for your help and patience!

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Crontab not working


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