Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Passing variable between servers Post 302370106 by sysrenan on Tuesday 10th of November 2009 11:37:51 AM
Old 11-10-2009
temhem, don't worry, when starting everything is "unknown"
but here you can read a little about scp on wikipedia: Secure copy - Wikipedia, the free encyclopedia

basically you would store the variables with values into a file on serverB, and on serverA you would run this command:

Code:
# scp user@serverB:/home/user/variable_file.txt ./

where all variables you need would be on server B inside the user's directory in file named variable_file.txt
and that would be copied into the current directory you are on serverA or instead you can use /home/you/ where I have " ./ "

When this command is executed you will be prompt for the "user" password on serverB, enter the password in order for the file to be copied.

If you want to copy this file without being asked for the password every time, you can look into PKI keys, where you have a private and a public key.

Here is how to do it as well:

On server A type:
Code:
# ssh-keygen -t rsa

don't enter any phrase just press enter

Then type:
Code:
ssh user@serverB mkdir -p .ssh

Then:
Code:
cat .ssh/id_rsa.pub | ssh user@serverB 'cat >> .ssh/authorized_keys'

after that you will be able to get files from the authorized user to your current serverA
Try the command again now:
Code:
# scp user@serverB:/home/user/variable_file.txt ./

hope this help, but next time you can do a little research on the forum or google and you will find many resource Smilie

take care

Last edited by pludi; 11-10-2009 at 12:52 PM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. Programming

Passing C Variable To Unix

I want to pass a variable set in my c program to a shell script (which will also be invoked or initiated from the same C program using the C's system command). Is it possible ? :confused: (3 Replies)
Discussion started by: kapilv
3 Replies

2. UNIX for Dummies Questions & Answers

Variable passing

Hi, If a script A(Parent) is running and script B(child) is run from script A, will the variables in script A be past to script B? Will the variables exist only for the duration of running the script? Thank you (2 Replies)
Discussion started by: whugo
2 Replies

3. Shell Programming and Scripting

Passing variable to perl

I need a non-perl (bash) way to strip the path from a list of "find" results. Below is the perl version which I could use, if I could figure out how to call the script with a variable (like in sh, $1 is the variable passed in ./script variable) $file = "/path/to/file.txt"; # How do I... (2 Replies)
Discussion started by: TheCrunge
2 Replies

4. UNIX for Dummies Questions & Answers

passing a variable inside a variable to a function

I would like to know how to pass a variable inside a variable to a function. sample code below -------------- for x in 1 9 do check_null $C$x ##call function to check if the value is null if then echo "line number:$var_cnt,... (2 Replies)
Discussion started by: KingVikram
2 Replies

5. Shell Programming and Scripting

passing a variable inside another variable.

Any help would be great. I know this is a dumb way of doing this, but I would like to know if there is a solution doing it this way. I'm very new at this and I'd like to learn more. Thanks! :D:D count=0 while ; do echo "enter your name" read name_$count let count=count+1 done ... (2 Replies)
Discussion started by: reconflux
2 Replies

6. Shell Programming and Scripting

Passing Variable in sed

Dear All, I want to print a file. First I tried with this sed '2q;d' filename it worked. But when i put following it is not working x=2; sed '$xq;d' filename Would any one suggest how to pass the variable? (7 Replies)
Discussion started by: saifurshaon
7 Replies

7. Shell Programming and Scripting

Passing variable with *

Hi Folks, I would like to pass a variable with a wild card in an argument. My script works if I don't use a wildcard but fails when I use *. I want to use the script like: scriptname -F <filename*> @ i = 0 while ($i <= ${#argv}) switch ($argv) case -F: set j = `echo $i +1... (2 Replies)
Discussion started by: dixits
2 Replies

8. Shell Programming and Scripting

Passing dynamic variable within another variable.

I have a small program which needs to pass variable dynamically to form the name of a second variable whose value wil be passed on to a third variable. ***************** Program Start ****************** LOC1=/loc1 PAT1IN=/loc2 PAT2IN=/loc3 if ; then for fpattern in `cat... (5 Replies)
Discussion started by: Cyril Jos
5 Replies

9. UNIX for Dummies Questions & Answers

Passing value of a variable in sed

Hi, I want to pass value of a variable track_line which is the line number to sed. Sed should print the lines starting from track_line till the last line of the file. I tried the below command but it is not working. sed -n '${track_line},$p' latest_log_file I tried using the below too but... (1 Reply)
Discussion started by: nitinupadhyaya8
1 Replies

10. UNIX for Advanced & Expert Users

Passing variable as input & storing output in other variable

I have a below syntax its working fine... var12=$(ps -ef | grep apache | awk '{print $2,$4}') Im getting expected output as below: printf "%b\n" "${VAR12}" dell 123 dell 456 dell 457 Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results... (5 Replies)
Discussion started by: sam@sam
5 Replies
MEMCP(1)							   libmemcached 							  MEMCP(1)

NAME
memcp - libmemcached Documentation Copies files to a collection of memcached servers SYNOPSIS
memcp [options] [file] [server] DESCRIPTION
memcp copies one or more files into memcached(1) servers. It is similar to the standard UNIX cp(1) command. The key names will be the names of the files, without any directory path. OPTIONS
You can specify servers via the option: --servers or via the environment variable: `MEMCACHED_SERVERS` If you do not specify either these, the final value in the command line list is the name of a server(s). For a full list of operations run the tool with the option: --help HOME
To find out more information please check: http://libmemcached.org/ AUTHOR
Brian Aker, <brian@tangent.org> Mark Atwood, <mark@fallenpegasus.com> SEE ALSO
memcached(1) libmemcached(3) AUTHOR
Brian Aker COPYRIGHT
2011-2013, Brian Aker DataDifferential, http://datadifferential.com/ 1.0.16 January 31, 2013 MEMCP(1)
All times are GMT -4. The time now is 08:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy