LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-07-2009, 04:36 AM   #1
solar05
LQ Newbie
 
Registered: Jun 2009
Posts: 9

Rep: Reputation: 0
SFTP script, status of the proccess


Hi. I have to copy between two hosts files via sftp.
I did some bash script
Code:
sftp -b /dev/fd/0 $TARGET_USER@$TARGET_HOST:$TARGET_DIR>>$FTPLOG 2>&1<<EOT
mput *.zip
chmod 666 *.zip
exit
EOT

status=$?					#status of process SFTP
if [ $status -eq 0 ]                       # if 0 then SUCCESS
then
	
    echo "Everything is good"
else
  	
echo "Error while copying the files"
fi
This script look's good, but when while sftp working my network connection
could break, and sftp session hung... and script didn't work.
Help me to resolve this problem.
 
Old 07-07-2009, 06:27 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
You could "encapsulate" the actual SFTP command ("cmdSftp() { sftp doSomething; }") so that some other process ("cmdTimer() { watchThisProcess; }") can start it and track process status. And please keep your posts on the same subject together (http://www.linuxquestions.org/questi...f-sftp-738233/).
 
Old 07-08-2009, 08:23 PM   #3
Niartov
LQ Newbie
 
Registered: Feb 2009
Posts: 8

Rep: Reputation: 0
Look into using an expect script.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Exit status of SFTP solar05 Programming 2 07-07-2009 07:43 AM
Setting up cron to proccess a Bash Script to run every 15 minutes jamtech Programming 3 07-30-2007 03:32 PM
Problem with sftp! (debug1: Exit status 127 Connection closed) nena Linux - Security 1 01-26-2006 07:29 PM
Proccess checking within shell script khutze Programming 2 08-12-2002 01:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration