[PVE-User] using virt-viewer in bash withouth sed and awk...

Diaolin diaolin at diaolin.com
Mon Mar 17 11:02:46 CET 2014


I don't know if anyone is interested in...

rewritten withouth sed and awk

bash only
i'm working on a similar script in w2k*

Ciao Diaolin



#!/bin/bash



USERNAME=$2
PASSWORD=$3
VMID=$1
NODE=myproxmox
PROXY=myproxmox.mydomain.com


if [ $# -lt "3" ]
then
     echo Usage $0 VMID USERNAME PASSWORD
     exit 0
else




DATA=`curl -k -d "username=$USERNAME&password=$PASSWORD" 
https://$PROXY:8006/api2/json/access/ticket`
CSRF=${DATA//\"/}
CSRF=${CSRF##*CSRFPreventionToken:}
CSRF=${CSRF%%,ticket*}

TICKET=${DATA//\"/}
TICKET=${TICKET##*ticket:}
TICKET=${TICKET%%,username*}

curl -k -b "PVEAuthCookie=$TICKET" -H "CSRFPreventionToken: $CSRF" 
https://$PROXY:8006/api2/spiceconfig/nodes/$NODE/qemu/$VMID/spiceproxy 
-d "proxy=$PROXY" > spiceproxy

remote-viewer spiceproxy

fi


---
S’à destacà l’ultima föia dal bósch nét
crodàda l’ei, solàgna, ‘n mèzz ai sàssi
e ‘ntant fis-ciava ‘n zìfol de oseleti
a tegnìr vìo ‘l pensér che vèn matìna
[Diaolin]



More information about the pve-user mailing list