Expect Script called from some other script works from Cron but only some files not all


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Expect Script called from some other script works from Cron but only some files not all
# 1  
Old 04-25-2020
Expect Script called from some other script works from Cron but only some files not all

Hi,
I have a Script in Solaris Machine that Generates Html Files total 23 nos
Then in that i have a expect script called from main script that copies html files to Other server which is Linux
Some times it don't copy all files and some times it copies File but with Size 0kb while file generated are proper
Here is my expect script

Code:
#!/home/spsy/real_time/digital/expect  -df
spawn sftp root@172.23.11.10
expect "root@172.23.11.10's password"
send "root!?\n"
expect "sftp>"
send "cd /var/www/html/web1/Archives/digital"
send "\n"
expect "sftp>"
send "lcd /home/spsy/real_time/digital/"
send "\n"
send "mput *.html"
send "\n"
expect "sftp>"
send "exit\n"
interact


and My Cron Job is like this
Code:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * ksh -c '. ~/.profile; /home/spsy/real_time/digital/online_status.ksh* 2>&1 > /home/spsy/real_time/digital/cron.log '

and output of Cron log is
Code:
spawn sftp root@172.23.11.10
Connecting to 172.23.11.10...
root@172.23.11.10's password:
sftp> cd /var/www/html/web1/Archives/digital
sftp> lcd /home/spsy/real_time/digital/
sftp> mput *.html
exit

can anyone tell me where i am wrong works perfectly when run manually
and also i have used /etc/profile in my main Script
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Execution problem with Cron: Script works manually but not w/Cron. Why?

Hello gurus, I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup is shown below: #!/bin/ksh db2... (3 Replies)
Discussion started by: okonita
3 Replies

2. Shell Programming and Scripting

Calling bash script works when called manually but not via Cron?

Hi, I've got a Bash backup script I'm trying to run on a directory via a cron job nightly. If I ssh in and run the script manually it works flawlessly. If I set up the cron to run evertything is totally messed up I don't even know where to begin. Basically the path structure is ... (6 Replies)
Discussion started by: wyclef
6 Replies

3. Shell Programming and Scripting

Expect script works on CLI, but not under Nagios

I'm having a problem scripting Expect to work as a Nagios check. The script runs fine from the cli, but not when run as a Nagios check. I turn on the debug output, and it looks like it's not seeing the whole buffer's worth of info, like it's paged interactively somehow. I'm new to Expect, but this... (1 Reply)
Discussion started by: dhargens
1 Replies

4. Shell Programming and Scripting

Expect script called in loop from Bash Script

Having issues with an expect script. I've been scripting bash, python, etc... for a couple years now, but just started to try and use Expect. Trying to create a script that takes in some arguments, and then for now, just runs a pwd command(for testing, final will be command I pass). Here is... (0 Replies)
Discussion started by: cbo0485
0 Replies

5. UNIX for Dummies Questions & Answers

Interpreting Shell Script errors when called from CRON

Hi All, I am calling a series of shell scripts via CRON so everything is running as root. However, in my error log file I am seeing the following errors. Please can anyone offer any advise as to the possible causes and solution to prevent the errors from appearing. The Error 1227 seems to... (2 Replies)
Discussion started by: daveu7
2 Replies

6. Shell Programming and Scripting

Sendmail works from script, but not when called from Apache

Hi, I am building a web interface to run a series of shell scripts that reside on the web server. The bash script are written such that they can be used independently for the task they are meant for, or the same scripts can be run from this web UI. The scripts are mostly for doing software... (1 Reply)
Discussion started by: MacQAGuy
1 Replies

7. Shell Programming and Scripting

Script not working when called by cron

Hello, I have the following script which works fine when ran from the command line: #!/apps/python/2.3.4/bin/python import os import sys import time user = os.getenv("USER") string = time.strftime("%m%d%y0000 " + user, time.gmtime()) However, when I have this run by crontab, I... (4 Replies)
Discussion started by: cooldude
4 Replies

8. Shell Programming and Scripting

How to determine if a script (perl) was called from a CRON job or commandline

Hi, Is there a way to determine if a Script is called from a CRON job or from a commandline Gerry. (2 Replies)
Discussion started by: jerryMcguire
2 Replies

9. Shell Programming and Scripting

How to determine the script is called from CRON?

Hello expert, What I want is to determine whether the script is called from CRON or it is executed interactively? I tried the following but no luck: #!/bin/ksh cronID=`pgrep -x cron` GPID=`ps -ef -o ppid,pid | grep " $PPID$" | awk '{print $1}'` if ; then echo I am being run... (15 Replies)
Discussion started by: wes_brooks
15 Replies

10. Shell Programming and Scripting

gzip in shell script called by cron

I'm puzzled by this one. I hope you can explain it to me. I have a ksh shell script that gzips a file among other things. This works perfectly fine when the script is manually run through a shell. However, when the same script is run through cron, it does everything correctly, but it will... (2 Replies)
Discussion started by: hbau419
2 Replies
Login or Register to Ask a Question