Executing a script from CRON behaves differently than terminal


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Executing a script from CRON behaves differently than terminal
# 1  
Old 09-03-2010
Executing a script from CRON behaves differently than terminal

Hi have a script which transferers from Microsoft server to Linux box.

The scripts(ksh) is on Linux box.

If I run script from terminal, it transfers files to directory. Where as If
I run script from CRON. It does not.

Here is the log of both:

Terminal execution log:
----------------------
Code:
Connected to 204.138.63.246.
220 Microsoft FTP Service
500 'AUTH GSSAPI': command not understood
500 'AUTH KERBEROS_V4': command not understood
KERBEROS_V4 rejected as an authentication type
331 Password required for progen.
230 User progen logged in.
?Invalid command
200 Type set to I.
local: 8581407_HO_20100902.pdf remote: 8581407_HO_20100902.pdf
227 Entering Passive Mode (204,138,63,246,12,67).
125 Data connection already open; Transfer starting.
226 Transfer complete.
414442 bytes received in 0.036 seconds (1.1e+04 Kbytes/s)

CRON execution log:
--------------------
Code:
Connected to 204.138.63.246 (204.138.63.246).
220 Microsoft FTP Service
331 Password required for progen.
230 User progen logged in.
?Invalid command
200 Type set to I.
Local: 8581407_HO_20100902.pdf remote: 8581407_HO_20100902.pdf
227 Entering Passive Mode (204,138,63,246,12,33).
125 Data connection already open; Transfer starting.
226 Transfer complete.
426891 bytes received in 0.0371 secs (1.1e+04 Kbytes/sec)
221

I don't see any files in the directoy if I run script from CRON.

Thanks in advance.
# 2  
Old 09-03-2010
If this is a root cron the files will probably be found in the home directory for the root account unless your script contains a suitable "cd" or your ftp commands contain a suitable "lcd".

Please post the current version of your script.
I think we last saw a version in a previous post.
https://www.unix.com/shell-programmin...tput-file.html
# 3  
Old 09-03-2010
Thanks!!

The problem has been resolved.

The problem was with Oracle Environment variables. My scripts is calling
Oracle stored procedures and functions. If script executed from CRON, the
Oracle related environment variable must be declared otherwise Oracle functions/procedures won't be executed.

I am amazed, log did not tell me the exact problem.

Thanks again!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

'Connect' behaves differently on Solaris 11

Our application fails to run successfully on Solaris 11. The same works fine in Solaris 10. Due to which we are unable to migrate to Solaris 11. The app basically involves forking a child process, which finally connects with parent process. But on Solaris 11, it is unable to connect with parent... (0 Replies)
Discussion started by: wini008
0 Replies

2. Shell Programming and Scripting

Expect script not executing via cron

Hello All, I'm having an issue getting an expect script to run as a cron job. The script executes fin if I run it from the command line but I get nothing when trying to run it as a cron job. I've researched other forums and threads and there have been references to the environment, or lack... (16 Replies)
Discussion started by: KingT617
16 Replies

3. Shell Programming and Scripting

Script not executing using cron

Hi, I created a script which connects to database and update a table. This script is running fine when i run it manually but when i am trying to execute it scheduling in crontab.script is executing but Data is not getting updated. below is my script sqlplus test/##### >> test_feed.log <<!... (6 Replies)
Discussion started by: sv0081493
6 Replies

4. Shell Programming and Scripting

executing a shell script everytime the terminal is opened

the problem statement is Write a shell script, which gets executed the moment the user opens a terminal. It should display the message "Hello your_name, welcome to 172.16.4.120 server” How to get around this? (2 Replies)
Discussion started by: arindamlive
2 Replies

5. Shell Programming and Scripting

why Cron behaves different ?

Hi, i have script called script.ksh script.ksh --------- echo "Narayana" >$HOME/script.log echo "$0" |sed 's/.ksh//' >>$HOME/script.log My question is: -------------- when iam executing on the prompt it is giving good results what we have expected... example on the prompt:... (4 Replies)
Discussion started by: lnviyyapu
4 Replies

6. Shell Programming and Scripting

su - user -c 'command' behaves differently

I notice that su - user (note with dash) brings in more of the user's environment than does su - user -c 'command'. For example, if root does an su - user, and types "umask" to the prompt, one umask is displayed; yet, if instead the command is su - user -c 'umask', the value is different. I thought... (2 Replies)
Discussion started by: drokerm
2 Replies

7. Windows & DOS: Issues & Discussions

Awk script in DOS and Linux behaves differently :(

Hi, I have an awk script which performs simple operations of variable assignments and finally printing the variables in custom form. BEGIN {FS=OFS="\n"} { v1=substr($0,1,15) v2=substr($0,16,200) v3=substr($0,216,20) print v1 "|" v2 "|" v3 } The input file being processed... (2 Replies)
Discussion started by: vidyak
2 Replies

8. Shell Programming and Scripting

simple CSH Script behaves differently on Solaris and RedHat Linux

I have a simple csh-script on a Solaris Workstaion which invokes the bc calculator: #!/bin/csh set shz=2 set zshift=5 set shzp=`bc -l <<END \ scale = 3 \ -1. * $shz + $zshift \ END` echo $shzp The result ($shzp) in this case is 3 (-1*2+5). It works fine on Solaris 8. ... (2 Replies)
Discussion started by: two reelers
2 Replies

9. Shell Programming and Scripting

Script behaves different when run from cron vs. manually

Hey all, Just wanted to get some input on a script I am using to import files into a MySQL database. The process is pretty simple: my main server exports these files and FTPs them. I have a script that FTPs them to the machine running that runs this script. The FTP script runs without issue... (2 Replies)
Discussion started by: billtwild
2 Replies

10. Shell Programming and Scripting

Why does cron run this differently?

test.ksh =================== #!/usr/bin/ksh APPLICATION=hr_app APPLICATION_UPPER=`echo $APPLICATION | tr ` echo $APPLICATION_UPPER > /tmp/test.txt echo $APPLICATION >> /tmp/test.txt which tr >> /tmp/test.txt =================== When I run this from the shell: /home/natter> more... (6 Replies)
Discussion started by: natter
6 Replies
Login or Register to Ask a Question