fix: add start to commands
This commit is contained in:
parent
62c86e1170
commit
433b33f98e
29
vmtool.sh
29
vmtool.sh
@ -32,9 +32,24 @@ if ! command -v qemu-system-"$EMU_ARCH" > /dev/null 2>&1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
start() {
|
||||
stop() {
|
||||
for ((i=0;i<NUM_NODES;i++))
|
||||
do
|
||||
pkill -F "$STATE_DIR"/node$i.pid >/dev/null 2>&1
|
||||
rm -f "$STATE_DIR"/node$i.pid
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
stop
|
||||
|
||||
for ((i=0;i<NUM_NODES;i++))
|
||||
do
|
||||
if ! [ -f "$STATE_DIR"/node$i.qcow2 ] || ! [ -f "$STATE_DIR"/node$i-cloudinit.iso ]; then
|
||||
echo "Missing disk images. Run create first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Starting node $i"
|
||||
qemu-system-x86_64 \
|
||||
-enable-kvm \
|
||||
@ -75,14 +90,6 @@ start() {
|
||||
echo "Where # is the node number you want to reach."
|
||||
}
|
||||
|
||||
stop() {
|
||||
for ((i=0;i<NUM_NODES;i++))
|
||||
do
|
||||
pkill -F "$STATE_DIR"/node$i.pid >/dev/null 2>&1
|
||||
rm -f "$STATE_DIR"/node$i.pid
|
||||
done
|
||||
}
|
||||
|
||||
destroy() {
|
||||
stop
|
||||
|
||||
@ -160,6 +167,10 @@ create() {
|
||||
}
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
shift
|
||||
start "$@"
|
||||
;;
|
||||
stop)
|
||||
shift
|
||||
stop "$@"
|
||||
|
Loading…
x
Reference in New Issue
Block a user