23 lines
491 B
Bash
Executable File
23 lines
491 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# https://linuxcontainers.org/incus/docs/main/howto/move_instances/
|
|
#
|
|
|
|
#set -x
|
|
|
|
while getopts d:m: flag
|
|
do
|
|
case "${flag}" in
|
|
d) DEST=${OPTARG};;
|
|
m) MODE=${OPTARG};;
|
|
esac
|
|
done
|
|
|
|
|
|
for CT in $(/usr/bin/incus list -c n -f compact,noheader status=RUNNING) ; do
|
|
DATE=$(date '+%Y-%m-%d %H:%M:%S')
|
|
echo "[${DATE}] incus copy ${CT} ${DEST}:$CT --refresh --mode push"
|
|
/usr/bin/incus copy $CT ${DEST}:$CT --refresh --mode ${MODE} 2>&1 > /dev/null
|
|
done
|
|
|