Envertecportal StationId auslesen

Endlich habe ich einen einfachen Weg gefunden wie man seine StationId vom Envertecportal bekommen kann.

1vi get_StationId.sh
 1#!/bin/bash
 2
 3scriptpath="$( cd "$(dirname "$0")" ; pwd -P )"
 4username="EMAIL-ADRESSE"
 5password="PASSWORD"
 6
 7# login to portal to get the session
 8wget -qO- -o /dev/null --keep-session-cookies --save-cookies ${scriptpath}/cookies.txt --post-data "username=${username}&pwd=${password}" http://www.envertecportal.com/apiaccount/login > /dev/null 2>&1
 9# download systemoverview page which contains the stationId
10wget -q --load-cookies ${scriptpath}/cookies.txt 'http://www.envertecportal.com/terminal/systemoverview' -O ${scriptpath}/systemoverview > /dev/null 2>&1
11# grep the stationId
12stationId=`grep "var stationId = '" ${scriptpath}/systemoverview | awk '{print $4}' | sed "s/'//g" | sed "s/;//g"`
13# output the sessionId
14echo "StationId: ${stationId}"
15# delete downloaded file
16rm "${scriptpath}/systemoverview"
1chmod +x get_StationId.sh
1./get_StationId.sh
2StationId: XXXXXXX

Wenn alles klappt baue ich das direkt in mein Script ein damit man sich damit nicht mehr beschäftigen muss.