![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Passing Variable in sed | saifurshaon | Shell Programming and Scripting | 7 | 03-02-2009 05:01 AM |
| passing a variable inside another variable. | reconflux | Shell Programming and Scripting | 2 | 12-05-2008 05:07 PM |
| Passing a variable to sed or cut | gugs | Shell Programming and Scripting | 5 | 08-11-2008 03:27 AM |
| passing a variable inside a variable to a function | KingVikram | UNIX for Dummies Questions & Answers | 2 | 01-14-2008 08:28 PM |
| variable passing to sed | Manish Jha | Shell Programming and Scripting | 2 | 08-18-2006 11:54 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
hi everyone,
i need to passing variable from one server to another server. How can i do it? Assume that i have got two servers (exp: A and B servers) i am in A server and i need to get value which in B server. i think i have to do ftp connection, but after connection how can i get variable? Thanx so much. |
|
||||
|
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 ./ 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 Then type: Code:
ssh user@serverB mkdir -p .ssh Code:
cat .ssh/id_rsa.pub | ssh user@serverB 'cat >> .ssh/authorized_keys' Try the command again now: Code:
# scp user@serverB:/home/user/variable_file.txt ./ ![]() take care Last edited by pludi; 1 Week Ago at 12:52 PM.. Reason: code tags, please... |
|
||||
|
THANK SO MUCH sysrenan,
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: Code:
ssh user@serverB "ls -ls" ![]() On ServerB: You can setup CRON JOB by issuing the command: Code:
# crontab -e * 12 * * * /home/user/myscript.sh name this myscript.sh (as on the cronjob, but you can change it) don't forget to add executable permission on this file Code:
#!/bin/bash #run the topl /home/oper/topl.sh #send variable files to serverA scp /home/oper/odeme user@serverA:/home/user/ scp /home/oper/taksit user@serverA:/home/user/ # log the date/time that files were copied echo "Variable files copied on $(date)" >> /home/oper/variablescopy.log |
|
||||
|
thank you very much sysrenan. Before reading your last response i solved it with Crontab
![]() you had thought like me. ![]() Thanx again my friend. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|