When running a script on remote server, I need prevent the nohup output from the remote server to be displayed on the ssh server.
I am running below command line to run a script on remote server.
ssh user@server.com "cd /cpmapps/soa/operations/bin/; ./restart_soa.sh stop"
But when it runs, it unpredictably displays the nohup output of a command in the 'remote server script'. Here's the excerpt from the script where you can see that the command is supposed to run in the background.
echo " Starting the weblogic Managed Server SOA"
nohup ./startManagedWebLogic.sh soa_server1 https://server:7002 & > soa.out 1>&2&
sleep 180
ps_count=`netstat -an | grep 7002 | egrep "LISTEN" |grep -v grep|wc -l`
echo ps_count $ps_count
if [ "$ps_count" -ne "0" ];then
echo "managed server is up"
echo "proceeding with starting BAM"
else
echo "Failed to start weblogic"
exit 1
fi
However, when I run the script on the server where the script is located, it runs as predicted. As shown below.
While when I run it from the remote server, it shows output for the command too. As shown below.
How can I make it run on the remote server the same way as it is running on the home server? Would really appreciate any help on this.