Restarting Tentacle

· ☕ 1 min read
🏷️
  • #octopus
  • Short post this time. I was reviewing the newsletter for Ocotopus Deploy and came across an article on automatically restarting Octopus Tentacle services.

    I liked the idea but as part of my automate all the things preference at the moment I thought it should be possible to do this without getting an GUI involved. Fortunately this is easily possible. Start a console/cmd session with suitable Administrator rights and type the following:

    sc failure "OctopusDeploy Tentacle" reset=0 actions= restart/0/restart/0/restart/0
    

    This happily set the first / second / subsequent failure actions.
    1i

    sc config "OctopusDeploy Tentacle" start= delayed-auto
    

    To set the startup to ‘Automatic (Delayed Start)’
    2i

    Hopefully this helps someone and/or makes me internet famous if it hits the Octopus Deploy newsletter! I might even check how hard it is to use the Ocotopus script console to run it.

    Update

    Script console worked well. Just used the following powershell to update a bunch of tentacles.

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    
    #Enable automatic recovery of *Tentacle* services
    $TentaclesServices = Get-Service | Where-Object {$_.name -like '*Tentacle*'}
    foreach($Tentacle in $TentaclesServices) {
        Write-Host Update serivce options for : $Tentacle.Name
        Write-Host `tDelayed start...
        sc.exe config $Tentacle.Name start= delayed-auto
        Write-Host `tRecovery options...
        sc.exe failure $Tentacle.Name reset=0 actions= restart/0/restart/0/restart/0
        Write-Host 'Complete'
    }
    
    Share this post