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.
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:
ssh user@serverB "ls -ls"
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:
# crontab -e
* 12 * * * /home/user/myscript.sh
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
#!/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