如何存储Tomcat服务器启动/停止时间在数据库中

发布于 2025-01-21 15:44:23 字数 211 浏览 4 评论 0原文

用例: 每当我们启动/停止Tomcat服务器时,它都应记录到数据库中。

解释: 假设我们启动服务器12:00,然后应该进入数据库Server1开始12:00 而且,如果在01:00关闭,请进入数据库Server1停止01:00

我试图以某种方式弄清楚,但是我们可以实现任何固体。 请让我知道任何解决此情况的解决方案。

我需要这个用于Liferay Tomcat服务器

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寻找我们的幸福 2025-01-28 15:44:23

您没有提及应该发生的操作系统 - 如果您在Linux上,您很可能会使用启动Tomcat作为背景daemon的脚本,并且可以轻松地将其此类操作脚本脚本拼写到启动脚本中。

守护程序脚本甚至可能调用Tomcat自己的startup.shcatalina.sh脚本,以便您可以增加它们。只需确保在升级会覆盖这些文件的情况下,请保持更改。

这将您的问题减少到“从BASH脚本写入数据库”。解决该问题需要知道您的数据库

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文