Create a script in the /etc/init.d folder
eg:data.sh
#chkconfig: 2345 80 90
#description:auto_run
#!bin/bash
export JAVA_HOME=/usr/java/jdk1.8.0_171-amd64
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
su - linux name of normal user <<!
cd /usr/elasticsearch/elasticsearch-5.3.3/
./bin/elasticsearch &
exit
!
Then give permission to the script
chomod +x data.sh
Suspended service
chkconfig --add data.sh (note the double "-")
Note again: the script of data.sh must have
#chkconfig: 2345 80 90
#description:auto_run
Otherwise, the service xx.sh in chkconfig times does not support chkconfig