java – Startup program at server start

Question:

as part of learning java (first jap) wrote a simple echo server with a client.

A friend gave access to a server running centos6 (first acquaintance with the nix (?) System).

After installing jre8, I was able to run .jar for execution.

How to add a file to startup at system startup?

Answer:

if you need a command to be executed at the end of the gnu / linux operating system boot, the easiest way to do this is to add this command at the end of the /etc/rc.local file.

but be careful: in some distributions, the last line in this file is the line

exit 0

in this case, your command should be added above this very line.


the command will be executed as the root user . if you need it to be executed on behalf of some other user, you can use this, for example, a construction:

su -c "ваша команда" пользователь
Scroll to Top