For example, the following script in this section
ssh $ i "java -jar / applog / $ PROJECT / $ APPNAME --server.port = $ SERVER_PORT> / dev / null 2> & 1 &"
Free linux adhesion log server, performs jar package,
By ssh to run java program, involves the issue of a JDK path can not be found, the script execution will be unsuccessful.
solution:
(1) a first mode
In the path ~ ll -a will find a hidden file .bashrc
[Kevin @ hadoop101 ~] $ CAT / etc / Profile >> .bashrc
[Kevin @ hadoop101 ~] $ Source / etc / Profile
The route addition to the JDK under .bashrc file, source what you can (clusters each virtual machine to be executed once).
(2) The second way
JDK write the full path in the script
JAVA_BIN=/bigdata/jdk1.8.0_152/bin/java
.................
ssh $i "$JAVA_BIN -Xms32m -Xmx64m -jar /applog/$PROJECT/$APPNAME --server.port=$SERVER_PORT >/dev/null 2>&1 &"
(3) Third embodiment
In the script quotes within the / etc / profile source about
ssh $i "source /etc/profile; java -jar /applog/$PROJECT/$APPNAME --server.port=$SERVER_PORT >/dev/null 2>&1 &"
---------------------
Author: Kevin siege lion
Source: CSDN
Original: https: //blog.csdn.net/wx1528159409/article/details/87893900
copyright Disclaimer: This article is a blogger original article, reproduced, please attach Bowen link!