To confirm the same kill your java process and see that it is automatically restarted. If the script is called with "start" option, the command to start the app will be executed and same goes for the stop case.Īfter configuring this, restart the monit service and changes will be reflected. This python script contains commands monit will run when it is instructed to start or stop our app. Now let us checkout the contents of the "check.py" file > The "if failed port" will judge the application status and will restart the app if nothing is found on port 8080. > The check.py file will contain the start and stop commands, here it is a little trick to use monit syntax with our use case. > The start and stop program line will instruct monit with how to restart the program with the command mentioned after the keywords > The "check process" keyword will check for the process named java matching the name "java -jar" Let us create a file for the same in "/etc/monit/conf.d" directory with the name "java" So here we will see how to monitor on the basis of the port. ![]() We can also monitor it based on the pad file but if the application is killed forcefully using "kill -9" the pit file will not be deleted and in this case, monit will consider the application is running. To monitor a Java application, we can monitor it on the basis of the port number on which the application is running and the process name. If you are new to monitor you can refer this link to install and configure it. This blog covers how to monitor your Java application and restart it on failure. Furthermore, monit accompanies a simple web UI through which the majority of the processes can be seen. ![]() Monit is a great opensource tool that consequently screens and manages server to guarantee that they remain online, as well as that the applications running, checksum etc are always right.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |