#!/bin/bash #### VARIABILI SCRIPTNAME=`echo $0 | awk -vFS='/' '{print $NF}'` #EXEC=/hosthome${PWD#$HOME}${0#'.'} waitfinish() { SEMAPHORE=$1.booting touch $SEMAPHORE while [ -f $SEMAPHORE ]; do sleep 2 done sleep 5 } notifyfinish() { rm $1.booting } startvm() { X="--new --exec=/hosthome${PWD#$HOME}/${SCRIPTNAME}" if [ -e r_pc1-pc1.disk ] || [ -e r_pc2-pc2.disk ] || [ -e r_1-r1.disk ] || [ -e r_2-r2.disk ] ; then echo "$0: some .disk file exists in this directory!" echo " launch "$0 crash" first" exit 1 fi vstart r_pc1-pc1 --eth0=A $X waitfinish r_pc1-pc1 vstart r_pc2-pc2 --eth0=C $X waitfinish r_pc2-pc2 vstart r_1-r1 --eth0=A --eth1=B $X waitfinish r_1-r1 vstart r_2-r2 --eth1=B --eth0=C $X waitfinish r_2-r2 echo '' echo ' *** all machines started ***' } crashvm() { vcrash r_pc1-pc1 vcrash r_pc2-pc2 vcrash r_1-r1 vcrash r_2-r2 } make_ripd_file() { cat > /etc/zebra/ripd.conf << EOF ! hostname ripd password root enable password root ! log file /var(log/zebra/ripd.log !ricorda che questa è una prova... EOF } make_zebra_file() { cat > /etc/zebra/zebra.conf <