将jar服务化,放到systemctl中的方法
  TEZNKK3IfmPf 2023年11月12日 24 0

一个node项目的demo

# the puppeteer of node service
[Unit]
Description=puppeteer

[Service]
TimeoutStartSec=180
TimeoutStopSec=30
# restart
# Restart=always
# RuntimeMaxSec=10800
# RuntimeMaxSec=30
# RestartSec=30
# exec
ExecStart=/usr/local/bin/node /home/xxx/xxxx/xxx/xxx/node/bbs/bin/www
ExecStop=/usr/bin/pkill node
# log
StandardOutput=syslog
StandardError=syslog

然后利用crontab定期重启即可。

那么简单定义一下我们的java程序jar

# 19999端口
[Unit]
Description=domaincheck

[Service]
TimeoutStartSec=100
TimeoutStopSec=30
ExecStart=/bin/java -Dserver.tomcat.basedir=. -Dserver.tomcat.accesslog.enabled=true -Dserver.port=19999 -jar -Dspring.redis.timeout=30000 /xxxxxx/p19876/xxxxx-0.0.1-SNAPSHOT.jar
# ExecStop=/usr/bin/pkill
【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月12日 0

暂无评论

推荐阅读
  TEZNKK3IfmPf   2024年04月19日   44   0   0 javajar
  TEZNKK3IfmPf   2024年05月17日   42   0   0 javajar
  TEZNKK3IfmPf   2023年11月15日   31   0   0 springjar
  TEZNKK3IfmPf   2024年04月19日   38   0   0 部署jar
TEZNKK3IfmPf