vagrant-lxc-ng/boxes/common/utils.sh

29 lines
493 B
Bash
Raw Normal View History

2014-03-09 22:34:59 +00:00
#!/bin/bash
mkdir -p $(dirname $LOG)
rm -f ${LOG}
touch ${LOG}
chmod +rw ${LOG}
utils.lxc.attach() {
cmd="$@"
log "Running [${cmd}] inside '${CONTAINER}' container..."
(lxc-attach -n ${CONTAINER} -- $cmd) &> ${LOG}
}
utils.lxc.start() {
lxc-start -d -n ${CONTAINER} &>${LOG} || true
}
utils.lxc.stop() {
lxc-stop -n ${CONTAINER} &>${LOG} || true
}
utils.lxc.destroy() {
lxc-destroy -n ${CONTAINER} &>${LOG}
}
utils.lxc.create() {
lxc-create -n ${CONTAINER} "$@" &>${LOG}
}