JackYumCha / QA

Question and Answer
0 stars 0 forks source link

Linux Service File Example #7

Open JackYumCha opened 6 years ago

JackYumCha commented 6 years ago

seekapi.service

[Unit]
Description=Seek API Web Service
[Service]
WorkingDirectory=/root/SeekAPI
ExecStart=/usr/bin/dotnet /root/SeekAPI/SeekAPI.dll
Restart=always
RestartSec=10
SyslogIdentifier=SeekAPI
User=root
[Install]
WantedBy=multi-user.target
JackYumCha commented 6 years ago

Put the file above to the following folder:

/etc/systemd/system/

JackYumCha commented 6 years ago

Use systemctl enable seekapi.service to install the service so it can start automatically when linux starts.

JackYumCha commented 6 years ago

1) start and stop service service seekapi start service seekapi stop

2) show service status service seekapi status