ws.server@.service: service to launch the .jar websocket server and restart it on fail/stop + install.sh: installs the service into 'systemd' + uninstall.sh: uninstalls all from 'systemd'
This commit is contained in:
commit
59c23a9132
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
# (1) Copy the systemd service file
|
||||||
|
sudo cp /opt/ws.server/ws.server@.service /lib/systemd/system/ws.server@.service;
|
||||||
|
|
||||||
|
# Note: cannot create a symlink, it will be too much link level
|
||||||
|
#sudo ln -s /opt/ws.server/ws.server@.service /lib/systemd/system/ws.server@.service;
|
||||||
|
|
||||||
|
# (2) Reload systemctl daemon to manage the new service
|
||||||
|
sudo systemctl daemon-reload;
|
||||||
|
|
||||||
|
# (3) Enable /opt/ws.server/ndli1718.jar to be executed at startup + restart on fail
|
||||||
|
sudo systemctl enable ws.server@ndli1718.service;
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
# (1) disable /opt/ws.server/ndli1718.jar
|
||||||
|
sudo systemctl disable ws.server@ndli1718.service;
|
||||||
|
|
||||||
|
# (2) Remove the service from systemd
|
||||||
|
sudo rm /lib/systemd/system/ws.server@.service;
|
||||||
|
|
||||||
|
# (3) Reload systemctl
|
||||||
|
sudo systemctl daemon-reload;
|
|
@ -0,0 +1,12 @@
|
||||||
|
[Unit]
|
||||||
|
Description=WebSocket Server [%i]
|
||||||
|
Before=network-pre.target
|
||||||
|
Wants=network-pre.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Restart=always
|
||||||
|
ExecStart=/usr/bin/env java -jar /opt/ws.server/%i.jar
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in New Issue