我有一个旧的 jetty 服务器,我想将其转变为 Debian 操作系统上的服务。每次重新启动计算机时它都会自动启动。
我使用以下两个命令手动启动服务器:
有人知道怎么做吗?
虽然是旧问题...
基于此链接https://wiki.debian.org/systemd/Services
# Contents of /etc/systemd/system/myjetty.service
[Unit]
Description=My Jetty
After=network.target
[Service]
Type=simple
Restart=always
ExecStart=<start command>
[Install]
WantedBy=multi-user.target
然后
systemctl daemon-reload
systemctl enable myservice.service # if you want restart on boot
systemctl start myservice.service # start now, you won't need this on next boots
如果
jetty
需要更多配置,请参阅文档https://manpages.debian.org/bookworm/systemd/systemd.exec.5.en.html
我希望有人能提供完整的答案,问题不会得不到解答
如果您想在启动时启动任何程序,您可以在
rc.local
中添加该条目。
java /opt/jdk/jetty/jetty
它将在重新启动时开始