Run "java -jar MyJar.jar" automatically on linux server, instead of on login and run from ssh

StackOverflow https://stackoverflow.com/questions/22250843

  •  11-06-2023
  •  | 
  •  

문제

How can I run a Java .jar file, fx "java -jar MyJar.jar" automatically on a Linux server, instead every time I login and run it from ssh?

I am looking for some way to automatically execute that command, or something to that effect.

Also, how can I direct all output to some logfile? (I guess stdio in autostrt is unavailable.)

도움이 되었습니까?

해결책 2

You can use the terminal hooks, like See this answers about the bashrc. When you make a login or open a new terminal on your server, the script will run and execute your script.

다른 팁

Since you reference "ssh", I'm gonna guess you are on *nix.

Have a look at cron

Redirecting output in *nix is easy, just use the ">" and "2>" redirections.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top