Solve the problem that the sch remote command cannot find JAVA_HOME

Recently, I am working on a set of automated scripts, and sometimes it is necessary to remotely trigger the execution of java programs.
But after logging in through ssh, you will find that JAVA_HOME cannot be found
. My JAVA_HOME is defined in /etc/profile. After a
little research, I found that the results are as follows:

/etc/profile: When the user logs in, this file is executed.
/etc/bashrc : When the bash shell is opened, the file is executed.

ssh is entered as a non-login method, and of course it cannot trigger the execution of /etc/profile.
So it should be set to /etc/bashrc.

Weibo cannot be reprinted, so record it here and make a backup.
Excerpted from http://blog.codeconch.com/archives/397


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327059081&siteId=291194637