1. Definir un servicio simple
Se ha consultado a https://linuxconfig.org/how-to-run-script-on-startup-on-ubuntu-20-04-focal-fossa-server-desktop
1. Ir a /etc/systemd/system
2. Crear el fichero socket-server.service
[Unit] After=network.service [Service] ExecStart=/home/informatica/MyPrograms/SOCKET_SERVER/startup_SocketServer.sh [Install] WantedBy=default.target3. El script a ejecutar (startup_SocksetServer.sh) es
#!/bin/bash# 1. show all argumentsecho $@# 2. Mostra directorimyFolder=`dirname "$0"`echo "The present working directory is $myFolder"#3. Execute java program/home/informatica/MyPrograms/jdk-15.0.2/bin/java -jar $myFolder/socketserver.jar S
4. Cambiar permisos
$ sudo chmod 744 /home/informatica/MyPrograms/SOCKET_SERVER/startup_SocketServer.sh
$ sudo chmod 664 /etc/systemd/system/socket-server.service
5. Arrancar el servicio
$ sudo systemctl daemon-reload $ sudo systemctl enable socket-server.service
2. Definir el servicio Tomcat
Se ha consultado a https://dantesquecsv.blogspot.com/2022/10/1-instalacion-del-servidor-tomcat.html
Gracias ...
ResponderEliminar