Start the specified service (Tomcat, Openfire) on Linux startup

In the near future, Openfire needs to be started in centos. The normal idea is to add a startup script to /etc/rc.local. The effect is as follows

/home/user/openfire-3.7.1/bin/openfire start

 The result is the following error, mainly because the environment variable is not configured under the root user.

No suitable Java Virtual Machine could be found on your system.
The version of the JVM must be at least 1.5.
Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.
You can also try to delete the JVM cache file /root/.install4j

 Solutions:

Add the startup script /home/user/openfire-3.7.1/bin/start.sh under the user user, and then in /etc/rc.local, add the running script using the specified user

Add the script to the /etc/rc.local file as follows:

su - user-c /home/user/openfire-3.7.1/bin/start.sh

 The content of the /home/user/openfire-3.7.1/bin/start.sh file is as follows:

#/home/user/openfire-3.7.1/bin/start.sh
/home/user/openfire-3.7.1/bin/openfire start

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326040960&siteId=291194637
Recommended