How to run .jar continually and automatically on Debian server?

后端 未结 3 1193
谎友^
谎友^ 2021-01-25 22:48

I have a .jar file I want to run all the time on a Debian server.

Currently I have figured out how to access the server via ssh on

3条回答
  •  天涯浪人
    2021-01-25 23:36

    One simple suggestion would be to run the jar file using Linux's CRON.

    This article from unix stack exchange should get you going the correct direction for running a jar file using cron.

    Alternatively, this article from mkyong.com is also clear and concise.

    For example:

    1. Connect using Cygwin
    2. Run crontab -e
    3. Enter 0 * * * * java -jar myjar.jar packageName.fileNameOfFileWithMainMethod to run the jar file every hour at the top of the hour. Or, to start it once on server startup enter @reboot java -jar myjar.jar packageName.fileNameOfFileWithMainMethod

提交回复
热议问题