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

Closed Thread
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:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old March 30th, 2005, 11:03 AM
Rudi28 Rudi28 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 47 Rudi28 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 49 sec
Reputation Power: 5
Exclamation Problem with crontab script

Hi Everyone,

I'm trying to setup a crontab entry and run a script that writes a line to a file (i'm doing this as a test since i want to get that working first before doing other things).

The crontab entry executes because I can see the entry for that script being made on the cron log. However, it has a bad return (rc=1). When I execute the script manually, it works fine.

The script that I'm calling from the crontab entry is as follows:

#!/bin/ksh
. /home/user/.profile
echo "This is the start of the cron call 'date'" >>
/export/home/user/scripterror.log

That's all. The permissions are fine. The script executes fine manually. The crontab entry runs when scheduled and has entries in the cron log. The script just doesn't get executed from the cron for some reason since it has the entry with a rc=1

Any help is appreciated. Thanks in advance.

Regards,

Rudi

Reply With Quote
  #2  
Old March 30th, 2005, 01:30 PM
Shiner_Man's Avatar
Shiner_Man Shiner_Man is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Atlantic City, NJ
Posts: 297 Shiner_Man User rank is Corporal (100 - 500 Reputation Level)Shiner_Man User rank is Corporal (100 - 500 Reputation Level)Shiner_Man User rank is Corporal (100 - 500 Reputation Level)Shiner_Man User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 13 h 12 m 54 sec
Reputation Power: 6
What users crontab entry are you using? Are you using the root crontab file?
__________________
I'll learn this stuff someday.

My Pointless Site

Reply With Quote
  #3  
Old March 30th, 2005, 03:07 PM
Rudi28 Rudi28 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 47 Rudi28 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 49 sec
Reputation Power: 5
Quote:
Originally Posted by Shiner_Man
What users crontab entry are you using? Are you using the root crontab file?


Yes. I'm using the root crontab and the cron runs. I see the entry in the log. However, it appears to have a problem with the script (rc=1).

Reply With Quote
  #4  
Old March 31st, 2005, 08:11 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 44 m 45 sec
Reputation Power: 9
have a look to: #!bin/ksh
this helps: #!/bin/ksh
do you see the diff?
__________________
working on Solaris[5-9], preferred languages french and C.

Reply With Quote
  #5  
Old March 31st, 2005, 09:11 AM
Rudi28 Rudi28 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 47 Rudi28 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 49 sec
Reputation Power: 5
Quote:
Originally Posted by guggach
have a look to: #!bin/ksh
this helps: #!/bin/ksh
do you see the diff?


Sorry I made a mistake when I typed it in this thread and corrected the mistake already. Thanks for pointing that out.

Yes, I see the difference and that's the way that I have it in the script. It's: #!/bin/ksh and the rest as it's in the first post. The script runs fine when submitted manually. When submitted with the cron, it has an entry in the cron log indicating that it ran but it has a script error code rc=1. So it doesn't work when submitted from the cron.

Thanks,

Rudi

Reply With Quote
  #6  
Old March 31st, 2005, 10:58 AM
Rudi28 Rudi28 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 47 Rudi28 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 49 sec
Reputation Power: 5
Hi Everyone,

Actually the problem wasn't with the script, but with the crontab entry.

I didn't know that the rc=1 could refer to a problem with the crontab entry as well. I thought it was only about the script that the crontab entry was trying to execute.

The problem is that I had 4 asterisks after the minutes and hour and before the script that I was trying to execute. I corrected this to look like:

45 11 * * * /home/user/crontest

and it worked fine. I could see the entry in the cron log with no return code and also the output of the crontest script to a file that I have setup. So this issue is solved.

Thanks again to everyone for their time and trying to help.

Regards,

Rudi

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Problem with crontab script


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 1 hosted by Hostway