LinuxQuestions.org
Review your favorite Linux distribution.
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 04-13-2008, 04:36 PM   #1
akhil.mud
LQ Newbie
 
Registered: Sep 2007
Posts: 17

Rep: Reputation: 0
scp help


hi all
i am writing a script which enolves transfering of data from one server to another,i have almost completed it but i just want to add two things in that which are:-

* is there any swtich avilable scp through which i can specify the password in the script itself

* second while my scp is gng on what condition should i add, so that it will continously show me df -h commond's output,please help



thanks
 
Old 04-13-2008, 04:48 PM   #2
jimbo1708
Member
 
Registered: Jan 2007
Location: Pennsylvania
Distribution: Ubuntu 8.10 Server/9.04 Desktop, openSUSE 11.1
Posts: 154

Rep: Reputation: 31
Quote:
Originally Posted by akhil.mud View Post
hi all
i am writing a script which enolves transfering of data from one server to another,i have almost completed it but i just want to add two things in that which are:-

* is there any swtich avilable scp through which i can specify the password in the script itself

* second while my scp is gng on what condition should i add, so that it will continously show me df -h commond's output,please help



thanks
Akhil,

Issue 1
You can specify passwordless login through ssh which is what scp uses, the problem with this is that you cannot make it only available to a certain script so you open yourself up to security issues if other people use the machine that the runs the script. Since scp can be used by a machine to send a file to another or it can be used by a machine to grab a file from another computer, if you "backup machine" is not readily accessible by less knowledgeble users, then run it on the "backup machine". Follow this tutorial to set up the passwordless login

http://ariadne.mse.uiuc.edu/Cluster/...g_through.html

Use Protocol 2.

Issue 2
I am not sure what you mean. are you running the script via cron or do you run this script manually? Is this to create a "progress bar"?


- Jim
 
Old 04-13-2008, 05:00 PM   #3
akhil.mud
LQ Newbie
 
Registered: Sep 2007
Posts: 17

Original Poster
Rep: Reputation: 0
hi again

Quote:
Originally Posted by jimbo1708 View Post
Akhil,

Issue 1
You can specify passwordless login through ssh which is what scp uses, the problem with this is that you cannot make it only available to a certain script so you open yourself up to security issues if other people use the machine that the runs the script. Since scp can be used by a machine to send a file to another or it can be used by a machine to grab a file from another computer, if you "backup machine" is not readily accessible by less knowledgeble users, then run it on the "backup machine". Follow this tutorial to set up the passwordless login

http://ariadne.mse.uiuc.edu/Cluster/...g_through.html

Use Protocol 2.

Issue 2
I am not sure what you mean. are you running the script via cron or do you run this script manually? Is this to create a "progress bar"?


- Jim






hi Jim,
i will use your tutorial for the issue one and about second i want to use the df -h commond,so that i would be aware of disk space issue while data is being transfered,so is it possible that while my script is executing scp,i can get df -h information too.
 
Old 04-13-2008, 05:13 PM   #4
jimbo1708
Member
 
Registered: Jan 2007
Location: Pennsylvania
Distribution: Ubuntu 8.10 Server/9.04 Desktop, openSUSE 11.1
Posts: 154

Rep: Reputation: 31
Quote:
Originally Posted by akhil.mud View Post
hi Jim,
i will use your tutorial for the issue one and about second i want to use the df -h commond,so that i would be aware of disk space issue while data is being transfered,so is it possible that while my script is executing scp,i can get df -h information too.
I still don't understand. Do you want to know that information before/after the script run manually, or do you want a report after an automated run of the script, or do you want the script to only backup if there is space?

- Jim
 
Old 04-13-2008, 05:42 PM   #5
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
You cannot do what you want (with the df -h) directly. One method is to have a second ssh connection whose sole purpose is to watch the df -h output. Another option is to use ssh with redirection instead of scp. For example, suppose you have:
Code:
scp /path/to/source user@server:/path/to/destination
Instead, you could do:
Code:
ssh user@server "cat > /path/to/destination | while true; do df -h; sleep 5; done" < /path/to/source
In a similar manner, you could take care of pulling a remote file.
 
Old 04-14-2008, 04:40 PM   #6
akhil.mud
LQ Newbie
 
Registered: Sep 2007
Posts: 17

Original Poster
Rep: Reputation: 0
thanks you all for replying.....it has solved my prob quite a bit but what i exactly want is that till my scp is in process, i should constantly get an update on the disk space,so that i can kill scp if there is no disk space

can some one tell me,something regarding this


Quote:
Originally Posted by jimbo1708 View Post
I still don't understand. Do you want to know that information before/after the script run manually, or do you want a report after an automated run of the script, or do you want the script to only backup if there is space?

- Jim
 
Old 04-14-2008, 08:47 PM   #7
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by akhil.mud View Post
what i exactly want is that till my scp is in process, i should constantly get an update on the disk space,so that i can kill scp if there is no disk space
First, scp should die by itself if there is not sufficient disk space. Second, as I said before, you cannot do this directly with scp. Third, you didn’t say what was wrong with the suggestion I posted. Did you try it? It accomplishes the equivalent of what you ask.
 
  


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
scp does not work and gives the following error message: scp: FATAL: Executing ssh1 i akay Linux - Networking 16 09-28-2008 11:41 PM
How can I use scp Jzarecta Linux - Networking 6 04-15-2006 02:52 AM
SCP how to the_rhino Linux - Newbie 5 02-11-2005 07:50 PM
What is SCP? radam Linux - Software 2 07-20-2004 07:07 PM
Help with SCP lfindle Linux - Newbie 14 07-09-2002 02:08 PM

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

All times are GMT -5. The time now is 11:09 AM.

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