storagenode/updater: recover command in Service Manager (#3425)
This commit is contained in:
parent
a8e4e9cb03
commit
ead8af3c16
@ -339,10 +339,6 @@ func fileExists(filename string) bool {
|
||||
return info.Mode().IsRegular()
|
||||
}
|
||||
|
||||
func main() {
|
||||
process.Exec(rootCmd)
|
||||
}
|
||||
|
||||
// TODO: improve logging; other commands use zap but due to an apparent
|
||||
// windows bug we're unable to use the existing process logging infrastructure.
|
||||
func openLog() (closeFunc func() error, err error) {
|
||||
@ -359,3 +355,7 @@ func openLog() (closeFunc func() error, err error) {
|
||||
}
|
||||
return closeFunc, nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
process.Exec(rootCmd)
|
||||
}
|
||||
|
@ -56,7 +56,10 @@ func (m *service) Execute(args []string, r <-chan svc.ChangeRequest, changes cha
|
||||
changes <- svc.Status{State: svc.StartPending}
|
||||
|
||||
go func() {
|
||||
_ = rootCmd.Execute()
|
||||
err := rootCmd.Execute()
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}()
|
||||
|
||||
changes <- svc.Status{State: svc.Running, Accepts: cmdsAccepted}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:fire="http://schemas.microsoft.com/wix/FirewallExtension">
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:fire="http://schemas.microsoft.com/wix/FirewallExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
|
||||
<Product Id="*" Name="Storj V3 Storage Node" Language="1033" Version="!(bind.FileVersion.Storagenodeexe)" Manufacturer="Storj Labs Inc." UpgradeCode="{B32CF5FC-0665-4712-B88A-22D299565F9E}">
|
||||
<Package Platform="x64" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
|
||||
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." AllowSameVersionUpgrades="yes" Schedule="afterInstallExecute"/>
|
||||
@ -40,7 +40,7 @@
|
||||
ErrorControl="normal"
|
||||
Arguments="run --config-dir "[INSTALLFOLDER]\""
|
||||
/>
|
||||
<ServiceControl Id="StoragenodeStartService" Start="install" Stop="both" Remove="uninstall" Name="storagenode" Wait="yes" />
|
||||
<ServiceControl Id="StoragenodeStartService" Start="install" Stop="both" Remove="both" Name="storagenode" Wait="yes" />
|
||||
|
||||
<fire:FirewallException Id="StoragenodePort" Name="storagenode.exe" Port="28967" Scope="any"/>
|
||||
</Component>
|
||||
@ -57,9 +57,18 @@
|
||||
Account="[SERVICEACCOUNT]"
|
||||
Password="[SERVICEPASSWORD]"
|
||||
ErrorControl="normal"
|
||||
Arguments="run --config-dir "[INSTALLFOLDER]\" --identity-dir "[IDENTITYDIR]\" --binary-location "[INSTALLFOLDER]\storagenode.exe" --log "[INSTALLFOLDER]\storagenode-updater.log""
|
||||
Arguments="run --config-dir "[INSTALLFOLDER]\" --identity-dir "[IDENTITYDIR]\" --binary-location "[INSTALLFOLDER]\storagenode.exe" --log "[INSTALLFOLDER]\storagenode-updater.log"">
|
||||
<util:ServiceConfig
|
||||
ServiceName="storagenode-updater"
|
||||
ResetPeriodInDays="1"
|
||||
RestartServiceDelayInSeconds="60"
|
||||
FirstFailureActionType="restart"
|
||||
SecondFailureActionType="runCommand"
|
||||
ThirdFailureActionType="runCommand"
|
||||
ProgramCommandLine="cmd /c "(echo %date% %time% recovery triggered to execute in 3 minutes && timeout 180 >NUL && echo %date% %time% recovery command executed: && copy /y "[INSTALLFOLDER]storagenode-updater.old.exe" "[INSTALLFOLDER]storagenode-updater.exe" && net start storagenode-updater) >> "[INSTALLFOLDER]storagenode-updater-recovery.log" 2>&1""
|
||||
/>
|
||||
<ServiceControl Id="StoragenodeUpdaterStartService" Start="install" Stop="both" Remove="uninstall" Name="storagenode-updater" Wait="yes" />
|
||||
</ServiceInstall>
|
||||
<ServiceControl Id="StoragenodeUpdaterStartService" Start="install" Stop="both" Remove="both" Name="storagenode-updater" Wait="yes" />
|
||||
</Component>
|
||||
|
||||
<Component Id="dashboardShortcut" Guid="{C48A862E-869D-4FD4-A215-D47092A40BAA}" Win64="yes">
|
||||
|
Loading…
Reference in New Issue
Block a user