-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added windows service installation and uninstallation scripts, update…
…d readme
- Loading branch information
carlo.maiorano
committed
Nov 13, 2017
1 parent
53e54ef
commit 9125d3c
Showing
4 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Write-Host "Checking if Chocolatey is installed" | ||
|
||
if ((Get-Command "choco" -ErrorAction SilentlyContinue) -eq $null) | ||
{ | ||
Write-Host "Unable to find Chocolatey (choco) in your PATH, please install it from https://chocolatey.org/" | ||
exit | ||
} | ||
|
||
Write-Host "Checking current priviledges" | ||
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(` | ||
[Security.Principal.WindowsBuiltInRole] "Administrator")) | ||
{ | ||
Write-Warning "You do not have Administrator rights to run this script!`nPlease re-run this script as an Administrator!" | ||
exit | ||
} | ||
|
||
Write-Host "Check if nssm is installed" | ||
|
||
if ((Get-Command "nssm" -ErrorAction SilentlyContinue) -eq $null) | ||
{ | ||
choco install -y nssm | ||
} | ||
|
||
if (Test-Path "$env:GOPATH\bin\sleeponlan.exe") | ||
{ | ||
$path="$env:GOPATH\bin\sleeponlan.exe" | ||
} else { | ||
$path = Read-Host 'Please insert the full path where sleeponlan.exe is installed' | ||
} | ||
|
||
$port = Read-Host 'Please insert the port number where you want to map your service' | ||
nssm install sleeponlan "$path" | ||
nssm set sleeponlan AppParameters "--port $port" | ||
nssm set sleeponlan DisplayName "Sleep on Lan service" | ||
nssm set sleeponlan Description "Simple Sleep on Lan service" | ||
nssm start sleeponlan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
nssm stop sleeponlan | ||
nssm remove sleeponlan |