I have a web service that runs on several different Redhat remote computers. Whenever I want to update a service, I synchronize the new webservice source code written in perl from the version control repository (I use perforce) and restart the service using this new synchronized perl code. I think it's too boring to register on remote computers one by one and execute this series of commands to restart the service one by one. Therefore, I wrote a bash script update.sh, as shown below, to "do it once in one place, update all machines." I ran this shell script on my local machine. But it does not seem to work. It only executes the first command "sudo -u webservice_username -i", as I can tell from the command line on my local machine. (The code below only shows how it will update one of the remote web services. "Export P4USER = myname" is for using the perforce client)
Why do I know that only the first command is executed? Good, because after entering the password for ssh on my local computer, it shows:
Your environment has been modified. Please check /tmp/webservice.env.
And he just got stuck there. I do not want to come back.
As suggested by the commentator, I added "-t" to ssh
This will return the local command line. But it seems strange, it cannot be written to this "dir", it says "cd: dir: There is no such file or directory", it also says "p4: command not found". Thus, it seems that the sudo -u command is executed without effect, and the export command is either not executed or is excluded without effect.
A detailed local log file is as follows:
Your environment has been modified. Please check /tmp/dir/.env. bash: line 0: cd: dir: No such file or directory bash: p4: command not found bash: line 0: cd: bin: No such file or directory bash: ./prog: No such file or directory tail: cannot open `../logs/service.log' for reading: No such file or directory tail: no files remaining
source share