Diferencia entre revisiones de «Crear un servicio en linux»
Ir a la navegación
Ir a la búsqueda
(No se muestran 2 ediciones intermedias del mismo usuario) | |||
Línea 1: | Línea 1: | ||
''Crear servicio'' | |||
nano /etc/systemd/system/name,service | |||
== Parametros == | == Parametros == | ||
Línea 30: | Línea 25: | ||
[Install] | [Install] | ||
WantedBy=multi-user.target | WantedBy=multi-user.target | ||
Guardamos los cambios. | |||
== Comandos == | |||
Eliminar enlaces simbólicos del servicio creado | |||
systemctl disable service | |||
Crear enlace simbólico | |||
systemctl enable service | |||
Actualizar cambio en el servicios. | |||
systemctl daemon-reload |
Revisión actual del 14:43 2 nov 2020
Crear servicio
nano /etc/systemd/system/name,service
Parametros
Ejemplo para ejecutar como servicio una aplicación netcore.
[Unit] Description=Example .NET Web API App running on Ubuntu [Service] WorkingDirectory=/var/www/helloapp ExecStart=/usr/bin/dotnet /var/www/helloapp/helloapp.dll Restart=always # Restart service after 10 seconds if the dotnet service crashes: RestartSec=10 KillSignal=SIGINT SyslogIdentifier=dotnet-example User=www-data Environment=ASPNETCORE_ENVIRONMENT=Production Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install] WantedBy=multi-user.target
Guardamos los cambios.
Comandos
Eliminar enlaces simbólicos del servicio creado
systemctl disable service
Crear enlace simbólico
systemctl enable service
Actualizar cambio en el servicios.
systemctl daemon-reload