LinuxQuestions.org
Review your favorite Linux distribution.
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 08-31-2006, 05:14 PM   #1
bret
Member
 
Registered: Apr 2005
Location: SLC, Utah
Distribution: RHEL 4, RHEL 5
Posts: 59

Rep: Reputation: 16
command works in shell, but not in cron


Okay guys/gals,

I want to make my problem explanation as simple as possible. I have a user, "03101" that can run the "touch" command in their shell, e.g.

touch /tmp/test.1

This works fine. test.1 now exists in /tmp. Now, I will edit 03101's crontab by running "crontab -e". Here is the entry in 03101's crontab:

53 14 * * * touch /tmp/test.2

So, I expected that at 14:53, the file test.2 would be in /tmp. It isn't. What's up with this? Any ideas?
 
Old 08-31-2006, 05:22 PM   #2
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware 14.1 (32 and 64 bit)
Posts: 1,587

Rep: Reputation: 121Reputation: 121
You should point cron to the complete path, so use /usr/bin/touch instead of just touch (if SUSE places touch in /usr/bin). Or create a PATH assignment at the crontab file's top ("PATH=/usr/bin" IMHO).
 
Old 08-31-2006, 05:32 PM   #3
bret
Member
 
Registered: Apr 2005
Location: SLC, Utah
Distribution: RHEL 4, RHEL 5
Posts: 59

Original Poster
Rep: Reputation: 16
I also did that. I took the user's path statement and put it at the beginning of the user's crontab, and I specified the full path for "touch". The crontab looks like this:

PATH=/home/03101/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/binpt/kde3/bin
28 15 * * * /usr/bin/touch /tmp/bret.2

Anyway, 03101's crontab still doesn't appear to be executing the statement.
 
Old 08-31-2006, 10:38 PM   #4
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
does it give you any errors. You can also do touch /tmp/test.2 > /tmp/error.log and it should send the output to a text file.
 
Old 09-01-2006, 12:02 AM   #5
isuck@linux
Member
 
Registered: Jun 2006
Distribution: messed up debian
Posts: 250

Rep: Reputation: 30
Do you have enabled cron.log? what does it say? are the permissions for the file set correctly?
 
Old 09-01-2006, 09:17 AM   #6
bret
Member
 
Registered: Apr 2005
Location: SLC, Utah
Distribution: RHEL 4, RHEL 5
Posts: 59

Original Poster
Rep: Reputation: 16
I have SuSE Enterprise 9. I'm not sure how to enable a cron.log. This is what I discovered last night: If I stopped cron and restarted cron, then the crontab works. So I know I'm not going crazy. Anyway, I shouldn't be required to stop and start cron to implement new changes to crontab. This sounds like a problem with cron. The cron rpm release is: cron-3.0.1-920.7
 
Old 09-01-2006, 09:18 AM   #7
isuck@linux
Member
 
Registered: Jun 2006
Distribution: messed up debian
Posts: 250

Rep: Reputation: 30
so, you are saying that you restarted cron and now the changes are working?
 
Old 09-01-2006, 10:12 AM   #8
bret
Member
 
Registered: Apr 2005
Location: SLC, Utah
Distribution: RHEL 4, RHEL 5
Posts: 59

Original Poster
Rep: Reputation: 16
That's right. But, if I need to modify the user's crontab again, then the only way to implement the change is to stop and start cron. I have opened a problem with Novell support.
 
Old 09-01-2006, 10:50 AM   #9
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
1. If you have paid support, ie from Novell, why are you bothering us, volunteers?
2. Cron looks at the last modified times on the directories that hold the cron files to see if it needs to (re)load modifications you made. Have you checked out those timestamps?
 
Old 09-01-2006, 12:58 PM   #10
bret
Member
 
Registered: Apr 2005
Location: SLC, Utah
Distribution: RHEL 4, RHEL 5
Posts: 59

Original Poster
Rep: Reputation: 16
Oh my! This didn't appear to be a support issue. Sorry for bothering you.
 
Old 09-04-2006, 03:16 AM   #11
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Quote:
Oh my! This didn't appear to be a support issue. Sorry for bothering you.
It wasn't my point to scare you away from these forums. They're a great place to get help.
My point is simply that paid support implies that you give someone money to fix your problems and to fix them fast. These forums, driven by volunteers, may have a lower response time than that and what would be the point of paying someone for support and then go an ask it to some (free) volunteers? Make the support earn whatever you pay them!

Was my second point relevant?
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 09:09 AM
btdownload*.py, works from Command Line, not from cron SkipHuffman Linux - Software 11 12-30-2005 03:55 PM
works on command not on cron rickict Linux - General 1 11-17-2005 03:52 PM
Command works on cmdline, not in cron? UrbanSlayer Linux - General 6 11-06-2005 12:14 PM
Perl shell-out to script dunna work. Works on command line. Why? jlangelier Linux - Software 1 08-28-2004 03:00 AM


All times are GMT -5. The time now is 02:39 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration