Crontab problem!


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Crontab problem!
# 1  
Old 11-13-2009
CPU & Memory Crontab problem!

Hi All,

i added a sh script to crontab, it run but there is sqlplus expression that generate a spool file(gun.lst). this expression didnt run.

Summary,

1- my main script is topl.sh that i added it to Cron via "crontab -e" command
2- There is "sqlplus username/password@serverA @umt.sql" expression in topl.sh
3-umt.sql exists:
SET heading OFF
SET termout off
SET underline OFF
col offline_directory format a50
SET pagesize 0
SET verify OFF
SET echo off
SET linesize 50
SET feedback off
spool gun
select t.deger from tts.parametre t where t.id=30
;
spool off
exit;

4- All commands,expressions which are in topl.sh run, but "sqlplus username/password@serverA @umt.sql" expression didnt run so topl.sh script didnt generate gun.lst spool file.

by the way, when i run topl.sh manuel(without Cron), it is successfully.everything is ok.

i dont know why gun.lst spool file wasnt generated, when i add it on Cron.

Not: i added it to cron like that:
00 9 * * * /....../topl.sh

Thanx.
# 2  
Old 11-13-2009
Hi,
have a look at the FAQ about cron.
The issues I see:
1) your environment is not set up: sqlplus is not found (PATH-variable), $ORACLE_HOME and $ORACLE_SID are not set.
2) I would use full pathnames when calling umt.sql and defining the outputfile gun.lst. Remember in cron your "current working directory" may not be what you expect...
# 3  
Old 11-14-2009
Cero is correct. Your environment is not setup. The reason for this is that cron does NOT automatically source the profile. You need to source it in your script. Let's say my default shell is ksh. In my scripts I always source the profile....


#!/usr/bin/ksh

#
# Source the profle.
#
# Note there is a space between the dot "." and the tilde "~"
#
# The tilde is equivalent to $HOME
#
. ~/.profile

Hope this helps and good luck.
# 4  
Old 11-14-2009
export USER=abcde; sh your.script

Quote:
Originally Posted by temhem
Hi All,

i added a sh script to crontab, it run but there is sqlplus expression that generate a spool file(gun.lst). this expression didnt run.

Summary,

1- my main script is topl.sh that i added it to Cron via "crontab -e" command
2- There is "sqlplus username/password@serverA @umt.sql" expression in topl.sh
3-umt.sql exists:
SET heading OFF
SET termout off
SET underline OFF
col offline_directory format a50
SET pagesize 0
SET verify OFF
SET echo off
SET linesize 50
SET feedback off
spool gun
select t.deger from tts.parametre t where t.id=30
;
spool off
exit;

4- All commands,expressions which are in topl.sh run, but "sqlplus username/password@serverA @umt.sql" expression didnt run so topl.sh script didnt generate gun.lst spool file.

by the way, when i run topl.sh manuel(without Cron), it is successfully.everything is ok.

i dont know why gun.lst spool file wasnt generated, when i add it on Cron.

Not: i added it to cron like that:
00 9 * * * /....../topl.sh

Thanx.
Hello,

in crontab (HP-UX) i use :

export USER=username; sh absolute_path_script

So the environment for the user is set properly.

Regards
# 5  
Old 11-16-2009
hi bdittmar,

where will i write "export USER=myusername" sh myscript.sh?

must i write these in .profile file or in crontab or ...?

Thanx
# 6  
Old 11-16-2009
Like this !

Quote:
Originally Posted by temhem
hi bdittmar,

where will i write "export USER=myusername" sh myscript.sh?

must i write these in .profile file or in crontab or ...?

Thanx
Hello,

for example:

50 02 * * 5 export USER=jobs4c;sh /daten/bse/etc/rc.startjob FC100

Regards
# 7  
Old 11-16-2009
Thank so much my friend, it is success and now everything is ok.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

problem with crontab

hi all does any on has explanation for this result bash-3.00$ crontab -e "/var/tmp/Ex1kayUW" No space left on device The crontab file was not changed. bash-3.00$ (2 Replies)
Discussion started by: osmannix
2 Replies

2. UNIX for Advanced & Expert Users

crontab problem

hi.. i have a program (tf.sh), and i want what it runs automatically with a "lapsus" of 2 hours. (1,3,5,7,9,11,13,15,17,19,21,23 hrs.) i know what i have to do it using crontab, but i donīt know how to do it. i have the next idea, but the problem is what it doesnīt run on my server... (11 Replies)
Discussion started by: DebianJ
11 Replies

3. AIX

Crontab problem

Hi to all. Guys, i have a truble with oracle user crontab. He work if i'm do 0-59 * * * * echo LOL> ~/test.txt But not work if me set realy norm date For example 14 17 28 12 * echo LOL> ~/test.txt In 17:14 28 December . In log file /var/adm/cron/log nothing.... Please... (3 Replies)
Discussion started by: jess_t03
3 Replies

4. Shell Programming and Scripting

Problem in crontab

Hi All, Am facing an issue while updating the crontab.Getting below error while updating the cron. cron/tmp.XXXX5fXBR6: No space left on device crontab: edits left in /tmp/crontab.XXXXEJX5gw Is there any file where i need to alter using root user so that i can update the cron. TIA... (9 Replies)
Discussion started by: Ashok_oct22
9 Replies

5. Shell Programming and Scripting

Crontab Problem

Dear All , I have .sh script wich has the following inside getFileName=Listportfolio.txt.`date +'%Y%m%d` ftp -n 172.10.10.1<<EOF user xxx xxx bin cd /home/gbs/FTP_Script get /home/gbs/FTP_Script/$getFileName bye EOF EOF when I run the... (3 Replies)
Discussion started by: habuzahra
3 Replies

6. UNIX for Advanced & Expert Users

crontab problem

hi all while using crontab -e im receiving 754 as output im unable to add a entry in crontab crontab -l is working fine OS: sun5.8 can some one please assist me (4 Replies)
Discussion started by: NIMISH AGARWAL
4 Replies

7. UNIX for Dummies Questions & Answers

problem with crontab

i added to my crontab file: * * * * * echo "hello" it works, i receive a message into my /var/mail/username and i receive: bob in addition to a large text add-on any help appreciated (1 Reply)
Discussion started by: cleansing_flame
1 Replies

8. UNIX for Dummies Questions & Answers

Problem with crontab

I'm trying to get crontab to run a script, but to test crontab I tried out a very simple command: `echo bob` here is my crontab file (I edited it by using `crontab -e`): ----------------- #!/bin/sh 23 10 * * * echo bob and at 10:23 every day I get a new message: in /var/mail/a... (3 Replies)
Discussion started by: cleansing_flame
3 Replies

9. Shell Programming and Scripting

crontab problem

HI, i am working on linux. i have crontab problem i wrote a small script and put it in a crontab . but the script is not running.. i have given following way in crontab -e 02 06 * * * /bin/csh /home/vr_test.csh but the above script is not running please rectify my... (26 Replies)
Discussion started by: rajan_ka1
26 Replies

10. UNIX for Dummies Questions & Answers

crontab problem

Hi, I trying to include a script in my crontab as user. I used "crontab -e" to include my script there but does not seem to work. If I understand correctly it is set to run at 11:20 every day, correct? Can anybody identify any error? <pre> #Sun Microsystems Inc. SunOS 5.7 Generic... (19 Replies)
Discussion started by: guest100
19 Replies
Login or Register to Ask a Question