Score:0

Connecting to another server by bash script

no flag

On server A I have a script in bash with a conditional. If the conditional is true, a connection is made to server B and httpd is reloaded. The script runs in cron and everything works correct.

I don't know what happens when the script ends, the connection to server 2 closes automatically? Now I in server B I don't see that user who loggin from server A is logged. That is correct ?

isInFile=$(something)

if [ $isInFile -eq 1 ]; then

ssh -p 1234 -i ~/.config/username/.ssh/id_rsa [email protected]

sudo systemctl reload httpd

fi 
Ginnungagap avatar
gu flag
Does the script ever end when the condition is true? What does the script output (both out and err) say?
ufo1990 avatar
no flag
I found solution my problem. I added parameter -t and now connection is closed after did command. ssh -p 1234 -i ~/.config/username/.ssh/id_rsa [email protected] -t 'sudo systemctl reload httpd'
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.