63 lines
1.5 KiB
Markdown
63 lines
1.5 KiB
Markdown
---
|
|
sidebar_position: 2
|
|
id: install-service
|
|
---
|
|
|
|
# Run as a service
|
|
|
|
To run LST as a serive there are 2 options to accomplish this
|
|
|
|
## Install
|
|
|
|
Utlizing the powershell script that is in the scripts folder
|
|
|
|
Open vscode once again or clear the termnial if you still have it open.
|
|
|
|
Next run the code below.
|
|
|
|
```bash
|
|
.\scripts\services.ps1 -serviceName "LST_app" -option "install" -appPath "E:\LST" -description "Logistics Support Tool" -command "run start"
|
|
```
|
|
|
|
This will
|
|
|
|
- Create a windows service using NSSM and call it LST_app
|
|
- It will also set the restart policy to restart 3 times
|
|
- It will depend on MSQLServer to make sure this is up and running before we try to connect to it
|
|
- It will start the node app
|
|
- And Lastly will set it to auto start once the server comes up.
|
|
|
|
## Stop the Service
|
|
|
|
To stop the service you can utilize the same script
|
|
|
|
```bash
|
|
.\scripts\services.ps1 -serviceName "LST_app" -option "stop" -appPath "E:\LST"
|
|
```
|
|
|
|
This will completely stop the service and you will need to start it
|
|
|
|
## Start the Service
|
|
|
|
Yet again utilizing the same script
|
|
|
|
```bash
|
|
.\scripts\services.ps1 -serviceName "LST_app" -option "start" -appPath "E:\LST"
|
|
```
|
|
|
|
## Deleteing the Service
|
|
|
|
This will compeltely remove the service from the server
|
|
|
|
```bash
|
|
.\scripts\services.ps1 -serviceName "LST_app" -option "delete" -appPath "E:\LST"
|
|
```
|
|
|
|
## Restart
|
|
|
|
This will stop the service wait 2 seconds and restart the service
|
|
|
|
```bash
|
|
.\scripts\services.ps1 -serviceName "LST_app" -option "restart" -appPath "E:\LST"
|
|
```
|