Add Service docs.
This commit is contained in:
parent
9f32b08beb
commit
b29a6efba5
Binary file not shown.
|
@ -23,7 +23,18 @@ Download `server.go` by running the following in a command prompt:
|
|||
```
|
||||
# Download the server file.
|
||||
powershell -Command Invoke-WebRequest -OutFile server.go https://git.rootprojects.org/josh/code-signing-final/raw/branch/master/All/server.go
|
||||
```
|
||||
### Custom Port
|
||||
|
||||
If you want the server to listen on a port other than port 80, you can edit this line in the `server.go` file:
|
||||
```
|
||||
port := flag.String("p", "80", "port to serve on")
|
||||
```
|
||||
Change "80" to whatever port you want to use.
|
||||
|
||||
## Version Info
|
||||
|
||||
```
|
||||
# Download a pre-made config file for goversioninfo:
|
||||
|
||||
powershell -Command Invoke-WebRequest -OutFile versioninfo.json https://git.rootprojects.org/josh/code-signing-final/raw/branch/master/All/versioninfo.json
|
||||
|
@ -147,12 +158,24 @@ Import command completed: 1 entries successfully imported, 0 entries failed or
|
|||
|
||||
You can find more information about how this works at the source: https://stackoverflow.com/a/50900084
|
||||
|
||||
## WIP: Service
|
||||
## Service
|
||||
|
||||
```
|
||||
SCHTASKS /Create /RU SYSTEM /SC ONSTART /TN "A Go Web Server" /TR "C:\Users\Josh\.local\opt\serviceman\bin\serviceman.A Go Web Server.exe"
|
||||
# Download the task file.
|
||||
powershell -Command Invoke-WebRequest -OutFile Server.xml https://git.rootprojects.org/josh/code-signing-final/raw/branch/master/All/Server.xml
|
||||
```
|
||||
|
||||
To change what file will be launched as administrator on boot, edit this line of the `Server.xml` file and replace the path in quotes.
|
||||
|
||||
Service: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-service?view=powershell-6
|
||||
Credential seems to be what makes it admin or not: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-service?view=powershell-6
|
||||
```
|
||||
<Command>"C:\Users\Josh\Downloads\server.exe"</Command>
|
||||
```
|
||||
|
||||
Run a command prompt as administrator, then run:
|
||||
|
||||
```
|
||||
# Create task based off the XML.
|
||||
SCHTASKS /create /XML "Server.xml" /tn "Task Name"
|
||||
```
|
||||
|
||||
You're done! It will launch your program as administrator by default on boot.
|
||||
|
|
Loading…
Reference in New Issue