.Net Core app built and located in /home/user/Smarthouse
Appliaction executable: Smarthouse is located in the folder above
# cd /home/user/Smarthouse
# chmod 755 Smarthouse
I am able to start app by running:
# ./Smarthouse
Application is running.
Create service file under /etc/systemd/system/
# vim /etc/systemd/system/smarthouse.service
Paste the following:
[Unit]
Description=.NET Web API App running on Linux
Wants = network-online.target
After = network.target network-online.target
[Service]
WorkingDirectory=/home/user/Smarthouse
ExecStart=/home/user/Smarthouse/Smarthouse
Restart=always
#Restart service after 10 seconds if crashes: RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnetSmarthouse
User=www-data Environment=ASPNETCORE_ENVIRONMENT=Production Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
Environment="DOTNET_BUNDLE_EXTRACT_BASE_DIR
=/var/tmp/.net/bundling"
[Install] WantedBy=multi-user.target
Save the file and run
# systemctl deamon-reload
# systemctl enable smarthouse.service
# systemctl start smarthouse.service