DEV Community

Cover image for Fleetctl destroy all services
Adam K Dean
Adam K Dean

Posted on

2 2

Fleetctl destroy all services

Here is a nice little bash trick to destroy all services using fleetctl.

fleetctl list-units | sed 1d | while read -r line ; \
    do fleetctl destroy $(echo $line | cut -f1 -d ' '); done
Enter fullscreen mode Exit fullscreen mode

It gets a list of units, removes the first line, loops through, grabs the first word, and and destroys it.

$ fleetctl list-units | sed 1d | while read -r line ; \
    do fleetctl destroy $(echo $line | cut -f1 -d ' '); done
Destroyed Job august-frosting_v4.web.1-announce.service
Destroyed Job august-frosting_v4.web.1-log.service
Destroyed Job august-frosting_v4.web.1.service
Destroyed Job august-frosting_v4.web.2-announce.service
Destroyed Job august-frosting_v4.web.2-log.service
Destroyed Job august-frosting_v4.web.2.service
Destroyed Job quaint-teamwork_v5.cmd.1-announce.service
Destroyed Job quaint-teamwork_v5.cmd.1-log.service
Destroyed Job quaint-teamwork_v5.cmd.1.service
Destroyed Job quaint-teamwork_v5.cmd.2-announce.service
Destroyed Job quaint-teamwork_v5.cmd.2-log.service
Destroyed Job quaint-teamwork_v5.cmd.2.service
Enter fullscreen mode Exit fullscreen mode

Now imagine typing each of those by hand.

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More