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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-13-2008, 05:36 PM
|
#1
|
LQ Newbie
Registered: Sep 2007
Posts: 17
Rep:
|
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
|
|
|
04-13-2008, 05:48 PM
|
#2
|
Member
Registered: Jan 2007
Location: Pennsylvania
Distribution: Ubuntu 8.10 Server/9.04 Desktop, openSUSE 11.1
Posts: 154
Rep:
|
Quote:
Originally Posted by akhil.mud
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
|
|
|
04-13-2008, 06:00 PM
|
#3
|
LQ Newbie
Registered: Sep 2007
Posts: 17
Original Poster
Rep:
|
hi again
Quote:
Originally Posted by jimbo1708
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.
|
|
|
04-13-2008, 06:13 PM
|
#4
|
Member
Registered: Jan 2007
Location: Pennsylvania
Distribution: Ubuntu 8.10 Server/9.04 Desktop, openSUSE 11.1
Posts: 154
Rep:
|
Quote:
Originally Posted by akhil.mud
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
|
|
|
04-13-2008, 06:42 PM
|
#5
|
HCL Maintainer
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450
Rep:
|
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.
|
|
|
04-14-2008, 05:40 PM
|
#6
|
LQ Newbie
Registered: Sep 2007
Posts: 17
Original Poster
Rep:
|
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
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
|
|
|
|
04-14-2008, 09:47 PM
|
#7
|
HCL Maintainer
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450
Rep:
|
Quote:
Originally Posted by akhil.mud
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.
|
|
|
All times are GMT -5. The time now is 06:56 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|