Last active
December 26, 2017 11:07
-
-
Save nl5887/a05e5de2f92c980a0a36 to your computer and use it in GitHub Desktop.
stop all lxc instances
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| lxc-ls --frozen | while read line; do echo Unfreezing $line; lxc-unfreeze --name $line; done < /dev/stdin | |
| lxc-ls --running | while read line; do echo Stopping $line; lxc-stop --name $line; done < /dev/stdin | |
| lxc-ls --frozen|grep -v troje_base | while read line; do echo Stopping $line; lxc-unfreeze --name $line; done < /dev/stdin | |
| lxc-ls --running|grep -v troje_base | while read line; do echo Stopping $line; lxc-stop --name $line; done < /dev/stdin | |
| lxc-ls --stopped|grep -v troje_base | while read line; do echo Stopping $line; lxc-destroy --name $line; done < /dev/stdin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The lxc-ls output format changed. Use
lxc-ls -1 --frozento make thewhile read linework.