NEWS
Hilfe bei Skripte von request auf httpGet umbauen
-
@liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:
poste doch mal deine httptest datei - da ist noch der wurm drin
#!/bin/bash dauer=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'` #curl "http://10.0.1.202:8081/set/0_userdata.0.Tests.htttpget-test?value=$dauer" iobroker state set 0_userdata.0.Tests.htttpget-test $dauer echo Temp: $dauer sleep 15 tempi=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'` iobroker state set 0_userdata.0.Tests.htttpget-test $tempi sleep 15 tempi=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'` iobroker state set 0_userdata.0.Tests.htttpget-test $tempi sleep 15 tempi=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'` iobroker state set 0_userdata.0.Tests.htttpget-test $tempi
-
die datei curl-format.txt hast du ins verzeichnis kopiert ?
-
@liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:
die datei curl-format.txt hast du ins verzeichnis kopiert ?
yes
-
in der ersten zeile dauer=......
ist da ein zeilenumbruch vor | awk '{print $2}' | sed -e 's/s/ - das muss in einer zeile stehen
-
kopiere das in die datei
#!/bin/bash dauer=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'` iobroker state set 0_userdata.0.Tests.htttpget-test $dauer sleep 15 tempi=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'` iobroker state set 0_userdata.0.Tests.htttpget-test $tempi sleep 15 tempi=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'` iobroker state set 0_userdata.0.Tests.htttpget-test $tempi sleep 15 tempi=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'` iobroker state set 0_userdata.0.Tests.htttpget-test $tempi
es dürfen keine zeilenumbrüche in den befehlen drin sein
-
@liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:
ist da ein zeilenumbruch vor | awk '{print $2}' | sed -e 's/s/ - das muss in einer zeile stehen
stimmt, da hats einen Zeilenumbruch reingehaun.
Aber auch ohne kommt nur:
pi@raspberrypi:/usr/local/bin $ httptest Warning: Failed to read curl-format.txtWarning: Failed to read curl-format.txtcurl: no URL specified! curl: try 'curl --help' or 'curl --manual' for more information /usr/local/bin/httptest: Zeile 5: http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365: Datei oder Verzeichnis nicht gefunden /usr/local/bin/httptest: Zeile 4: iobroker: Kommando nicht gefunden. Warning: Failed to read curl-format.txtcurl: no URL specified! curl: try 'curl --help' or 'curl --manual' for more information /usr/local/bin/httptest: Zeile 7: http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365: Datei oder Verzeichnis nicht gefunden /usr/local/bin/httptest: Zeile 6: iobroker: Kommando nicht gefunden. Warning: Failed to read curl-format.txtcurl: no URL specified! curl: try 'curl --help' or 'curl --manual' for more information /usr/local/bin/httptest: Zeile 9: http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365: Datei oder Verzeichnis nicht gefunden /usr/local/bin/httptest: Zeile 8: iobroker: Kommando nicht gefunden. /usr/local/bin/httptest: Zeile 10: iobroker: Kommando nicht gefunden.
-
funktioniert der befehl in der console allein
curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'
-
@liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:
kopiere das in die datei
pi@raspberrypi:/usr/local/bin $ httptest Warning: Failed to read curl-format.txtWarning: Failed to read curl-format.txtcurl: no URL specified! curl: try 'curl --help' or 'curl --manual' for more information /usr/local/bin/httptest: Zeile 5: http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365: Datei oder Verzeichnis nicht gefunden /usr/local/bin/httptest: Zeile 4: iobroker: Kommando nicht gefunden. Warning: Failed to read curl-format.txtcurl: no URL specified! curl: try 'curl --help' or 'curl --manual' for more information /usr/local/bin/httptest: Zeile 7: http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365: Datei oder Verzeichnis nicht gefunden /usr/local/bin/httptest: Zeile 6: iobroker: Kommando nicht gefunden. Warning: Failed to read curl-format.txtcurl: no URL specified! curl: try 'curl --help' or 'curl --manual' for more information /usr/local/bin/httptest: Zeile 9: http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365: Datei oder Verzeichnis nicht gefunden /usr/local/bin/httptest: Zeile 8: iobroker: Kommando nicht gefunden. /usr/local/bin/httptest: Zeile 10: iobroker: Kommando nicht gefunden. pi@raspberrypi:/usr/local/bin $ sudo nano httptest pi@raspberrypi:/usr/local/bin $ httptest Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 3: iobroker: Kommando nicht gefunden. Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 6: iobroker: Kommando nicht gefunden. Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 9: iobroker: Kommando nicht gefunden. Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 12: iobroker: Kommando nicht gefunden. pi@raspberrypi:/usr/local/bin $
-
@liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:
funktioniert der befehl in der console allein
leider nein
pi@raspberrypi:/usr/local/bin $ curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//' Warning: Failed to read curl-format.txtpi@raspberrypi:/usr/local/bin $
-
@negalein zeig mal ls -la im verzeichnis -
-
@liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:
ls -la
pi@raspberrypi:/usr/local/bin $ ls -la insgesamt 11072 drwxrwsr-x 2 root staff 4096 Mai 28 09:21 . drwxrwsr-x 11 root staff 4096 Jul 7 2019 .. -rwxr-xr-x 1 pi pi 1909682 Apr 9 2019 composer -rw-r--r-- 1 root staff 0 Mai 27 22:58 curl-format.txt -rwxr-xr-x 1 root staff 1232 Mai 28 09:21 httptest -rwxr-xr-x 1 root staff 23084 Apr 9 2019 mbus-serial-request-data -rwxr-xr-x 1 root staff 21632 Apr 9 2019 mbus-serial-request-data-multi-reply -rwxr-xr-x 1 root staff 23428 Apr 9 2019 mbus-serial-scan -rwxr-xr-x 1 root staff 21840 Apr 9 2019 mbus-serial-scan-secondary -rwxr-xr-x 1 root staff 20132 Apr 9 2019 mbus-serial-select-secondary -rwxr-xr-x 1 root staff 22400 Apr 9 2019 mbus-serial-set-address -rwxr-xr-x 1 root staff 15448 Apr 9 2019 mbus-serial-switch-baudrate -rwxr-xr-x 1 root staff 21256 Apr 9 2019 mbus-tcp-application-reset -rwxr-xr-x 1 root staff 23460 Apr 9 2019 mbus-tcp-raw-send -rwxr-xr-x 1 root staff 22248 Apr 9 2019 mbus-tcp-request-data -rwxr-xr-x 1 root staff 21420 Apr 9 2019 mbus-tcp-request-data-multi-reply -rwxr-xr-x 1 root staff 22272 Apr 9 2019 mbus-tcp-scan -rwxr-xr-x 1 root staff 14864 Apr 9 2019 mbus-tcp-scan-secondary -rwxr-xr-x 1 root staff 15676 Apr 9 2019 mbus-tcp-select-secondary -rwxr-xr-x 1 root staff 9094204 Jul 7 2019 vzlogger pi@raspberrypi:/usr/local/bin $
-
@negalein
evtl ein rechte themaim verzeichnis sudo chmod 777 curl-format.txt
-
dann nochmal
curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'
-
@liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:
dann nochmal
pi@raspberrypi:/usr/local/bin $ curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//' Warning: Failed to read curl-format.txtpi@raspberrypi:/usr/local/bin $
-
@negalein aaarghh
mach mal sudo httptest
-
@liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:
mach mal sudo httptest
das ist eine Zicke
pi@raspberrypi:/usr/local/bin $ sudo httptest Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 3: iobroker: Kommando nicht gefunden. Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 6: iobroker: Kommando nicht gefunden. Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 9: iobroker: Kommando nicht gefunden. Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 12: iobroker: Kommando nicht gefunden. pi@raspberrypi:/usr/local/bin $
-
siehe chat
-
sehr gut. das wäre die bibliothek gewesen, die ich auch verwendet hätte.
bei den headers könnte man ein paar noch entfernen, aber die stören so ja nicht. -
warum probiert ihr jetzt noch mit einer curlversion?
-
@oliverio sagte in Hilfe bei Skripte von request auf httpGet umbauen:
warum probiert ihr jetzt noch mit einer curlversion?
der curl ist ein Test für ein anderes Script, dass alle 10 Minuten einen Timeout hat.