Browse Source

Add Service docs.

master
Josh Mudge 4 years ago
parent
commit
b29a6efba5
  1. BIN
      All/Server.xml
  2. 31
      All/Sign Using OV Cert.md

BIN
All/Server.xml

Binary file not shown.

31
All/Sign Using OV Cert.md

@ -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.
```
<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"
```
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
You're done! It will launch your program as administrator by default on boot.

Loading…
Cancel
Save