Skip to content

Commit bf44b71

Browse files
Update restart.ps1
Corrected some issues
1 parent 2435db4 commit bf44b71

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

bin/restart.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ $serverPath = "$SPLUNKHOME\etc\restartserver.txt"
44
$dsPath = "$SPLUNKHOME\etc\restartds.txt"
55
$guidPath = "$SPLUNKHOME\etc\restartguid.txt"
66
$dateTimePath = "$SPLUNKHOME\etc\restartdatetime.txt"
7-
$restartInput = {$(Test-Path "$SPLUNKHOME\etc\restartinput.txt" -PathType Leaf)}
8-
$restartServer = {$(Test-Path "$SPLUNKHOME\etc\restartserver.txt" -PathType Leaf)}
9-
$restartDS = {$(Test-Path "$SPLUNKHOME\etc\restartds.txt" -PathType Leaf)}
10-
$restartGUID = {$(Test-Path "$SPLUNKHOME\etc\restartguid.txt" -PathType Leaf)}
11-
$restartDateTime = {$(Test-Path "$SPLUNKHOME\etc\restartdatetime.txt" -PathType Leaf)}
7+
$restartInput = $(Test-Path "$SPLUNKHOME\etc\restartinput.txt" -PathType Leaf)
8+
$restartServer = $(Test-Path "$SPLUNKHOME\etc\restartserver.txt" -PathType Leaf)
9+
$restartDS = $(Test-Path "$SPLUNKHOME\etc\restartds.txt" -PathType Leaf)
10+
$restartGUID = $(Test-Path "$SPLUNKHOME\etc\restartguid.txt" -PathType Leaf)
11+
$restartDateTime = $(Test-Path "$SPLUNKHOME\etc\restartdatetime.txt" -PathType Leaf)
1212

1313
### Filter to attach timestamps where necessary
1414
filter timestamp {"$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss.fff') ${env:COMPUTERNAME}: $_"}
@@ -17,19 +17,19 @@ if ($restartInput -eq "True" -OR $restartServer -eq "True" -OR $restartDS -eq "T
1717
Write-output "One or more settings has been changed." | timestamp
1818
Write-output "Restarting forwarder." | timestamp
1919
if ($restartInput -eq "True") {
20-
Delete-Item -path "$inputPath"
20+
Remove-Item -path "$inputPath"
2121
}
2222
if ($restartServer -eq "True") {
23-
Delete-Item -path "$serverPath"
23+
Remove-Item -path "$serverPath"
2424
}
2525
if ($restartDS -eq "True") {
26-
Delete-Item -path "$dsPath"
26+
Remove-Item -path "$dsPath"
2727
}
2828
if ($restartGUID -eq "True") {
29-
Delete-Item -path "$guidPath"
29+
Remove-Item -path "$guidPath"
3030
}
3131
if ($restartDateTime -eq "True") {
32-
Delete-Item -path "$dateTimePath"
32+
Remove-Item -path "$dateTimePath"
3333
}
3434
sleep 5
3535
$restart = "restart"

0 commit comments

Comments
 (0)