Skip to content

Commit

Permalink
start the mondoo service delayed start (#474)
Browse files Browse the repository at this point in the history
* fix sudo error in macos updater

Signed-off-by: Patrick Münch <[email protected]>

* configure windows service with delayed start

Signed-off-by: Patrick Münch <[email protected]>

* configure the windows service with delayed start

Signed-off-by: Patrick Münch <[email protected]>

---------

Signed-off-by: Patrick Münch <[email protected]>
  • Loading branch information
atomic111 authored Sep 4, 2024
1 parent c3c9dee commit 9df028d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
12 changes: 9 additions & 3 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,15 @@ function Install-Mondoo {
info " * Restarting $Product Service as it is already running"
Restart-Service -Name Mondoo -Force
}
Set-Service -Name Mondoo -Status Running -StartupType Automatic
If(((Get-Service -Name Mondoo).Status -eq 'Running') -and ((Get-Service -Name Mondoo).StartType -eq 'Automatic') ) {
success "* $Product Service is running and start type is automatic"
IF((Get-Host).Version.Major -le 5) {
Set-Service -Name Mondoo -Status Running -StartupType Automatic
sc.exe config Mondoo start=delayed-auto
} Else {
Set-Service -Name Mondoo -Status Running -StartupType AutomaticDelayedStart
}

If(((Get-Service -Name Mondoo).Status -eq 'Running') -and ((Get-Service -Name Mondoo).StartType -contains 'Automatic') ) {
success "* $Product Service is running and start type is automatic delayed start"
} Else {
fail "Mondoo service configuration failed"
}
Expand Down
3 changes: 2 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,8 @@ autoupdater() {
sudo_cmd launchctl bootout system/com.mondoo.autoupdater
sudo_cmd rm -f /Library/LaunchDaemons/com.mondoo.autoupdater.plist

sudo_cmd curl -sSL https://install.mondoo.com/sh -o /Library/Mondoo/bin/mondoo-updater.sh
sudo_cmd curl -sSL https://install.mondoo.com/sh -o /tmp/mondoo-updater.sh
sudo_cmd cp /tmp/mondoo-updater.sh /Library/Mondoo/bin/mondoo-updater.sh
sudo_cmd chmod a+x /Library/Mondoo/bin/mondoo-updater.sh

sudo_cmd tee /Library/LaunchDaemons/com.mondoo.autoupdater.plist <<EOL
Expand Down
2 changes: 1 addition & 1 deletion powershell/Mondoo.Installer/Mondoo.Installer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
RootModule = './Mondoo.Installer.psm1'

# Version number of this module.
ModuleVersion = '1.4.1'
ModuleVersion = '1.4.2'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
12 changes: 9 additions & 3 deletions powershell/Mondoo.Installer/Mondoo.Installer.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,15 @@ function Install-Mondoo {
info " * Restarting $Product Service as it is already running"
Restart-Service -Name Mondoo -Force
}
Set-Service -Name Mondoo -Status Running -StartupType Automatic
If(((Get-Service -Name Mondoo).Status -eq 'Running') -and ((Get-Service -Name Mondoo).StartType -eq 'Automatic') ) {
success "* $Product Service is running and start type is automatic"
IF((Get-Host).Version.Major -le 5) {
Set-Service -Name Mondoo -Status Running -StartupType Automatic
sc.exe config Mondoo start=delayed-auto
} Else {
Set-Service -Name Mondoo -Status Running -StartupType AutomaticDelayedStart
}

If(((Get-Service -Name Mondoo).Status -eq 'Running') -and ((Get-Service -Name Mondoo).StartType -contains 'Automatic') ) {
success "* $Product Service is running and start type is automatic delayed start"
} Else {
fail "Mondoo service configuration failed"
}
Expand Down

0 comments on commit 9df028d

Please sign in to comment.