Created
September 20, 2017 04:30
-
-
Save lcherone/c5a6cd57092f9b69cd20affad1f3e5ee to your computer and use it in GitHub Desktop.
LXD run command in all running containers
This file contains 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 | |
# | |
# Run command in all running containers | |
# Usage: $ ./lxc-exec-all.sh apt update && apt upgrade | |
# | |
for container in $(lxc list volatile.last_state.power=RUNNING -c n --format csv); do | |
lxc exec "$container" "$@" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should put
--
before"$@"
so it won't confuse things for lxc options. Super helpful gist though.