Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Expect Script called from some other script works from Cron but only some files not all Post 303046150 by AnantMomaya on Saturday 25th of April 2020 10:21:23 AM
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
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
SCITOOLS(1)						      General Commands Manual						       SCITOOLS(1)

NAME
scitools - run a SciTools command SYNOPSIS
scitools command [OPTIONS] DESCRIPTION
The scitools script takes a command and runs a corresponding utility. The available commands are listed below. file2interactive Utility for taking a set of Python statements in a file and creating the corresponding interactive Python shell session. floatdiff Script for examining differences in regression tests involving floating-point numbers. Used in [1]. regression Simple front-end script to SciTools' Regression module. Used in [1]. ps2mpeg Utility for turning a set of PostScript files into an MPEG movie, using mpeg_encode or ppmtompeg. profiler Script for simplifying the execution of Python's profiling tools. Used in [1]. rename Script for renaming a set of files by substituting one string or regular expression with another. subst Script for subsituting a phrase by another in a set of files. Accepts regular expressions. Treated in [1]. replace Script for subsituting a phrase by another in a set of files. Does not use regular expressions, just plain text (well suited for substituting text with much use of backslashes, curly braces, and other special characters in regular expressions (e.g., LaTeX text). movie Script for creating a movie file from a sequence of image files (frames). By default an HTML file for displaying the image (PNG) files are made. pyreport Processes a Python script and pretty prints the results using LateX. If the script uses show() commands (from scitools.easyviz) they are caught by pyreport and the resulting graphs are inserted in the output pdf. Comments lines starting with "#!" are interpreted as rst lines and pretty printed accordingly in the pdf. [1] H. P. Langtangen: Python Scripting for Computational Science. Third edition, second printing. Springer, 2009. OPTIONS
-h, --help Show usage for all commands and exit. BUGS
Send comments, questions, bug reports etc. to scitools@googlegroups.com. LICENSE
SciTools is licensed under the new BSD license. AUTHOR
SciTools is written by Hans Petter Langtangen <hpl@simula.no>, Johannes Ring <johannr@simula.no>, Ilmar Wilbers <ilmarw@simula.no>, and Rolv E. Bredesen <rolv@simula.no>. This manual page is written by Johannes Ring <johannr@simula.no>. SCITOOLS(1)
All times are GMT -4. The time now is 08:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy