1
+
2
+ #
3
+ # V1.0
4
+ # Created by craeckor
5
+ # Nginx-Manager
6
+ # A simple Powershell Windows-Forms Nginx-Manager
7
+ #
8
+
9
+ # Checks if nginx.exe is available. If not = error message
1
10
if (Test-Path " .\nginx.exe" ) {
2
11
Add-Type - AssemblyName System.Windows.Forms
3
12
Add-Type - AssemblyName System.Drawing
4
13
14
+ # Import Icon from nginx.exe
5
15
$icon = [System.Drawing.Icon ]::ExtractAssociatedIcon(" nginx.exe" )
6
16
17
+ # Get current Nginx version
7
18
$nginxv = cmd / c nginx.exe - v 2 ` > `& 1
8
19
$nginxv = $nginxv | ConvertFrom-String - Delimiter nginx | Select-Object - ExpandProperty P3
9
20
$nginxv = $ ($nginxv -replace " /" , " " )
@@ -20,6 +31,7 @@ if (Test-Path ".\nginx.exe") {
20
31
}
21
32
}
22
33
34
+ # Another function to check if nginx is running
23
35
function CheckNginxStatus2 {
24
36
$nginxStatus = Get-Process - Name nginx - ErrorAction SilentlyContinue
25
37
if ($nginxStatus ) {
@@ -41,11 +53,13 @@ if (Test-Path ".\nginx.exe") {
41
53
}
42
54
}
43
55
56
+ # Function to execute nginx commands, capture the information and give the information out
44
57
function ExecuteNginxCommandwithCapture ($command ) {
45
58
$nginxoutput = cmd / c nginx.exe $command 2 ` > `& 1
46
59
[System.Windows.Forms.MessageBox ]::Show(" $nginxoutput " , " Information" , " OK" , " Information" )
47
60
}
48
61
62
+ # Function to start nginx
49
63
function StartNginx {
50
64
$isNginxrunning = CheckNginxStatus2
51
65
if ($isNginxrunning ) {
0 commit comments