#!/bin/bash

echo "Saving logs on USB key"
if [ -d "$TMPDIR/log" ]; then
	ts=`date +"%Y-%m-%d-%H-%M-%S"`
	cp /tmp/ssstk.log $TMPDIR/log/$ts.log
fi

echo "Unmounting the key"
umount $TMPDIR
rmdir $TMPDIR

echo "Stopping the server in 30''"
sleep 30
poweroff
