basically you would store the variables with values into a file on serverB, and on serverA you would run this command:
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:
don't enter any phrase just press enter
Then type: Then:
after that you will be able to get files from the authorized user to your current serverA Try the command again now:
hope this help, but next time you can do a little research on the forum or google and you will find many resource
take care
Last edited by pludi; 11-10-2009 at 12:52 PM..
Reason: code tags, please...
i successed login to server B without password(vi RSA algorithm).
But before running "scp user@serverB:/home/user/variable_file.txt ./"
i have to run topl.sh script on serverB automatically (without manuel).
i can login to serverB without password. after login i have to run topl.sh that will creat "odeme" and "taksit" files. After generation files i will copy these files to serverA via mget command.
But after login "topl.sh" script cant run automatically.
But after login i cant run ""
sftp username@serverB
cd /home/oper
sh ./topl.sh
mget odeme
mget taksit
bye
!
Really you are very helpfully,thanx a lot again.
---------- Post updated at 04:16 AM ---------- Previous update was at 03:28 AM ----------
last part was that:
sftp username@serverB<<-EOF
cd /home/oper
sh ./topl.sh
mget odeme
mget taksit
bye
EOF
temhem, you will not be able to run the command "sh" on sftp, from what I know.
if you want to execute commands on serverB and have the output on serverA you can do for example:
more efficient I think is that you can make all this on serverB, write a script that will do all this and run a CRON Job to send the files from serverB to serverA
On ServerB:
You can setup CRON JOB by issuing the command:
this will run every 12th hour everyday
name this myscript.sh (as on the cronjob, but you can change it)
don't forget to add executable permission on this file
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)