1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

added some script for the live usb image

This commit is contained in:
Steffen Vogel 2015-03-19 17:20:49 +01:00
parent c42163366f
commit 24b7de3499
2 changed files with 53 additions and 0 deletions

10
contrib/liveusb/chroot.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
mount /dev/sdb1 /media/usb
for part in dev sys proc; do
umount /media/usb/$part
mount -o bind /$part /media/usb/$part
done
chroot /media/usb

43
contrib/liveusb/setup.sh Executable file
View file

@ -0,0 +1,43 @@
#!/bin/bash
set -e
RECEIPENTS="stvogel@eonerc.rwth-aachen.de,mstevic@eonerc.rwth-aachen.de"
FROM="Simulator2Simulator Server <acs@0l.de>"
SERVER=tux.0l.de
USER=acs
PORT=$(shuf -i 60000-65535 -n 1)
IP=$(curl -s http://ifconfig.me)
# check if system has net connectivity. otherwise die...
ssh -q -o ConnectTimeout=2 $USER@$SERVER
# setup SSH tunnel for mail notification
ssh -f -N -L 25:localhost:25 $USER@$SERVER
# setup SSH reverse tunnel for remote administration
ssh -f -N -R $PORT:localhost:22 $USER@$SERVER
# send mail with notification about new node
mail -s "New S2SS node alive: $IP ($HOSTNAME)" -a "From: $FROM" "$RECEIPENTS" <<EOF
There's a new host with the S2SS LiveUSB Image running:
Reverse SSH tunnel port: $PORT
Internet IP: $IP
Hostname: $HOSTNAME
Latency:
$(ping -qc 5 $SERVER)
Traceroute:
$(traceroute $SERVER)
Interfaces:
$(ip addr)
Hardware:
$(lshw)
EOF