'How to store tomcat Server Start/Stop time in database
Use case: Whenever we start/stop the tomcat server, it should log entry into database.
Explanation: Assume we start the server 12:00, then it should make a entry into database Server1 start 12:00 and if shutdown at 01:00 then make a entry into database Server1 stop 01:00
I tried to figure out some way, but nothing solid which can we implemented. Do let me know any solution to build this scenario.
I need this for Liferay Tomcat Server
Solution 1:[1]
You don't mention the operating system that this should happen on - if you're on Linux, you're most likely using a script that starts tomcat as background-daemon, and you can easily script such an operation into the startup script.
The daemon script probably even calls tomcat's own startup.sh or catalina.sh script, so that you could augment them. Just make sure you keep your changes at hand in case of an upgrade that would overwrite those files.
This reduces your problem to "writing to a database from a bash script". And solving that problem would require to know your database
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Olaf Kock |
