Skip to content

Instantly share code, notes, and snippets.

@UtahDave
Forked from lcherone/lxc-exec-all.sh
Created May 15, 2019 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save UtahDave/a2c378e059fcb1b6a84ccfce3c1f6e9b to your computer and use it in GitHub Desktop.
Save UtahDave/a2c378e059fcb1b6a84ccfce3c1f6e9b to your computer and use it in GitHub Desktop.
LXD run command in all running containers
#!/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