distribute VM-images with aria2 instead of ctorrent
This commit is contained in:
parent
e30a7032a5
commit
40962fd9de
23 changed files with 444 additions and 434 deletions
30
roles/lmn_vm/files/vm-aria2
Executable file
30
roles/lmn_vm/files/vm-aria2
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
# if less than one arguments supplied, display usage
|
||||
if [[ $# -ne 2 ]]; then
|
||||
echo "This script takes as input the name of the VM " >&2
|
||||
echo "Usage: $0 [start|stop] vm_name" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
COMMAND="$1"
|
||||
VM_NAME="$2"
|
||||
|
||||
source /etc/lmn/vm.conf
|
||||
|
||||
if [[ "${COMMAND}" = "start" ]]; then
|
||||
systemd-run --unit=aria2-"${VM_NAME}" \
|
||||
--slice=system-aria2 \
|
||||
--uid="$(id -u lmnsynci)" \
|
||||
--gid="$(id -g lmnsynci)" \
|
||||
--nice=19 \
|
||||
--working-directory="${VM_SYSDIR}" \
|
||||
--collect \
|
||||
--property=Type=exec \
|
||||
--property=SuccessExitStatus=1 \
|
||||
aria2c --bt-hash-check-seed=true --check-integrity=true --seed-ratio=0.0 --dht-entry-point="${SEEDBOX_HOST}:${SEEDBOX_PORT}" "${VM_SYSDIR}/${VM_NAME}.qcow2.torrent"
|
||||
elif [[ "${COMMAND}" = "stop" ]]; then
|
||||
systemctl stop "aria2-${VM_NAME}.service" || echo "Aria2-Service not running"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue