![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems . |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| exiting from script | arghya_owen | Shell Programming and Scripting | 1 | 06-02-2008 07:36 AM |
| SFTP not working in cron | ewilson0265 | Shell Programming and Scripting | 4 | 12-02-2007 11:29 AM |
| SFTP errorcode 1 when run on cron but runs manually | Heidi.Ebbs | SUN Solaris | 2 | 08-08-2007 01:16 PM |
| Script Not Exiting??? | lesstjm | Shell Programming and Scripting | 1 | 07-11-2007 12:58 PM |
| exiting in c | ruffenator | High Level Programming | 3 | 04-28-2002 03:31 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I am using a script to transfer a file from a unix host to another unix host. The code snippet for sftp in the script is as below.
sftp -oIdentityFile=$ID_FILE_NAME -oNumberOfPasswordPrompts=0 $REMOTE_USERID@$REMOTE_HOST <<EOF cd incoming put $REPORT_FILE $REPORT_TARGET_FILE_NAME quit EOF When I run this script from the command prompt, it works as expected. But when I run this as a cron job, the script does not exit properly. It transfers the file as expected, but when I see the process list I can see that the script has spawned 2 other sub processes and is waiting for them to exit. This is how the process tree looks like. [user@host]$ ptree 10238 491 /usr/sbin/cron 10207 sh -c . /home/admin/user/.profile > /dev/null 2>&1; /user/app/scripts/sftpRepor 10238 /bin/ksh /user/app/scripts/sftpReport.sh 10243 sftp -v -oIdentityFile=/home/admin/user/.ssh/IdForHost -oNumberOfPasswordP 10244 ssh -oProtocol = 2 -s -oForwardAgent = no -oForwardX11 = no -o IdentityFile=/ho [user@host]$ The cron entry is as below. 35 15 * * * . /home/admin/user/.profile > /dev/null 2>&1; /user/app/scripts/sftpReport.sh >> /user/log/sftpReport.sh.log 2>&1 I thought of giving the commands using a batch file i.e. by the command sftp -b batch_filename....., but unfortunately the usage information I get is as below. bash-2.05$ sftp usage: sftp [-1vC] [-osshopt = value] [user@]host bash-2.05$ The version of ssh in my host is as below. bash-2.05$ ssh -V SSH Version Sun_SSH_1.0.1, protocol versions 1.5/2.0. Below is the error part of verbose output of sftp when run from cronjob. .......................... .......................... debug1: ssh-userauth2 successfull: method publickey debug1: fd 6 setting O_NONBLOCK debug1: fd 7 IS O_NONBLOCK debug1: fd 8 setting O_NONBLOCK debug1: channel 0: new [client-session] debug1: send channel open 0 debug1: Entering interactive session. debug1: client_init id 0 arg 0 debug1: Sending subsystem: sftp debug1: channel 0: open confirm rwindow 0 rmax 16384 sftp > debug1: channel 0: read<=0 rfd 6 len 0 debug1: channel 0: read failed debug1: channel 0: input open->drain debug1: channel 0: close_read debug1: channel 0: ibuf empty debug1: channel 0: input drain->closed debug1: channel 0: send eof debug1: channel 0: rcvd eof debug1: channel 0: output open->drain debug1: channel 0: obuf empty debug1: channel 0: output drain->closed debug1: channel 0: close_write debug1: channel 0: send close debug1: channel_input_channel_request: channel: 0 rcvd request for exit-status reply 0 debug1: cb_fn 2b74c cb_event 91 debug1: channel 0: rcvd close debug1: channel 0: full closed2 debug1: channel_free: channel 0: status: The following connections are open: #0 client-session (t4 r0 i8/0 o128/0 fd -1/-1) debug1: channel_free: channel 0: dettaching channel user Below are some information regarding the host and package installations. Let me know if you would require any further information to analyse this problem. [user@host]$ version Machine hardware: sun4u OS version: 5.9 Processor type: sparc Hardware: SUNW,Sun-Fire-V240 The following components are installed on your system: Sun Studio 11 Sun Studio 11 C Compiler Sun Studio 11 C++ Compiler Sun Studio 11 Tools.h++ 7.1 Sun Studio 11 C++ Standard 64-bit Class Library Sun Studio 11 Fortran 95 Sun Studio 11 Performance Library Sun Studio 11 Documentation Set version of "/opt/SUNWspro/bin/../prod/bin/../../bin/cc": Sun C 5.8 2005/10/13 version of "/opt/SUNWspro/bin/../prod/bin/../../bin/CC": Sun C++ 5.8 2005/10/13 version of "/opt/SUNWspro/bin/../prod/bin/../../bin/f90": Sun Fortran 95 8.2 2005/10/13 [user@host]$ which version /opt/SUNWspro/bin/version [user@host]$ pkginfo | grep -i ssh application SUNWsrshp NetConnect 3.X Self-Service Hardware Alarms (SSHA) Provider IM system SUNWsshcu SSH Common, (Usr) system SUNWsshdr SSH Server, (Root) system SUNWsshdu SSH Server, (Usr) system SUNWsshr SSH Client and utilities, (Root) system SUNWsshu SSH Client and utilities, (Usr) [user@host]$ ssh -V SSH Version Sun_SSH_1.0.1, protocol versions 1.5/2.0. Please help me resolve this issue. |
|
||||
|
Quote:
(a) lets you dictate exactly what environment gets set up (b) determine which shell will be used using "#!/bin/sh". (c) let's you test the script in isolation (d) means you can change the script without changing the crontab entry. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|