sudo apt update
sudo apt install sshpass
machineno="01"
virtualno="00"
storagetype="sata3"
scpserverip='183.0.184.5'

result=$machineno'_'$virtualno
echo "write to file:" $result
mac=`curl "http://localhost:49193/method?info" | awk '{print $6}' | sed -e 's/"//g' -e 's/,//g'`
echo "mac:" $mac

image_id=`docker images | grep lego | awk '{print $3}'`
echo "image_id: " $image_id

docker stop tencent_sv
docker rm tencent_sv 

command=`docker run --name tencent_sv --cap-add=SYS_PTRACE --privileged=true --net=host --env MAC=$mac --env NIC=ppp0 -v /openfogos/tencent_sv:/lego/extern -v /etc/localtime:/etc/localtime -d $image_id`

echo "run result: " $command

docker ps -a 

docker inspect tencent_sv | grep $mac 

account=`cat /etc/ppp/peers/dsl-provider | grep '163.gd' | awk '{print $2}' | sed -e 's/"//g'`
echo "account: "  $account

disktype=`df -hT | grep G | grep -v overlay | grep 85% | awk '{print $2}'`
echo "disktype: " $disktype

echo $mac  $account  '#'$machineno'-'$storagetype'-openfog-'$virtualno  $disktype > $result
sshpass -p "root123" scp $result root123@$scpserverip:~/linfz/$result 
