Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auto-tx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
auto-tx
Commits
989ebf42
Commit
989ebf42
authored
7 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Logging changes.
Refers to
#13
parent
b6e4ce37
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AutoTx-Updater/Update-Service.ps1
+3
-8
3 additions, 8 deletions
AutoTx-Updater/Update-Service.ps1
with
3 additions
and
8 deletions
AutoTx-Updater/Update-Service.ps1
+
3
−
8
View file @
989ebf42
...
...
@@ -57,14 +57,12 @@ function Exit-IfDirMissing([string]$DirName, [string]$Desc) {
function
Stop-MyService
{
Write-Host
-NoNewLine
"Stopping service
$(
$ServiceName
)
: "
try
{
Stop-Service
"
$(
$ServiceName
)
"
-ErrorAction
Stop
Write-
H
os
t
"
[OK]"
-Fore
Green
Write-
Verb
os
e
"
Stopped service
$(
$ServiceName
)
."
}
catch
{
$ex
=
$_
.
Exception
.
Message
Write-Host
"[FAILED]"
-Fore
Red
Send-MailReport
-Subject
"Shutdown of service
$(
$ServiceName
)
failed!"
`
-Body
"Trying to stop the service results in this error:
`n
$(
$ex
)
"
Exit
...
...
@@ -76,15 +74,12 @@ function Start-MyService {
if
((
Get-Service
$ServiceName
)
.
Status
-eq
"Running"
)
{
Return
}
Write-Host
-NoNewLine
"Starting service
$(
$ServiceName
)
: "
try
{
Start-Service
"
$(
$ServiceName
)
"
-ErrorAction
Stop
Write-
H
os
t
"
[OK]"
-Fore
Green
Write-
Verb
os
e
"
Started service
$(
$ServiceName
)
."
}
catch
{
$ex
=
$_
.
Exception
.
Message
Write-Host
"[FAILED]"
-Fore
Red
Write-Host
$ex
Send-MailReport
-Subject
"Startup of service
$(
$ServiceName
)
failed!"
`
-Body
"Trying to start the service results in this error:
`n
$(
$ex
)
"
Exit
...
...
@@ -234,7 +229,7 @@ function Update-ServiceBinaries {
if
(
Test-Path
"
$MarkerFile
"
-Type
Leaf
)
{
Return
}
Log
-Info
-Message
"No m
arker
f
ile
found
, trying to update service
binaries
."
Log
-Info
"Marker file (
$(
$M
arker
F
ile
)
) missing
, trying to update service."
Stop
-MyService
Copy
-ServiceFiles
New
-Item
-Type
File
"
$MarkerFile
"
|
Out
-Null
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment