|
|
|
| |||||||||
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
What users crontab entry are you using? Are you using the root crontab file?
|
|
#3
|
|||
|
|||
|
Quote:
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). ![]() |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
|||
|
|||
|
Quote:
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 |
|
#6
|
|||
|
|||
|
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 |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Problem with crontab script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|