Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Shell] script + cronjob = keine Werte...!?

Featured Replies

Geschrieben

Hallo,

 

... bin am verzweifeln:

 

Ein cronjob soll Sensoren mittels Shellscript abfragen, die Werte in einer (temporären) Datei ablegen um sie (später irgendwann) mit einer RRDTool + Grafik

auf einer Webseite darzustellen. Soweit der Traum - doch bereits Schritt 1 geht in die Hose :'(  ...

 

Also folgendes Script habe ich auf meinem RaspberryPi geschrieben:

#!/bin/sh
HOST=192.168.---.---
UID_MASTER=------
UID_TEMPERATURE=---
UID_HUMIDITY=---
UID_AMBIENTLIGHT=---

tinkerforge --host $HOST call temperature-bricklet $UID_TEMPERATURE \
get-temperature  \
--execute "echo 'scale=2; {temperature} / 100' | bc | xargs printf 'Outside temperature is %.1f °C\n'"

tinkerforge --host $HOST call humidity-bricklet $UID_HUMIDITY \
get-humidity \
--execute "echo 'scale=2; {humidity} / 10' | bc | xargs printf 'Outside humidity is %.1f %%Rh\n'"

tinkerforge --host $HOST  call ambient-light-bricklet $UID_AMBIENTLIGHT \
get-illuminance \
--execute "echo 'scale=2; {illuminance} / 10' | bc | xargs printf 'Ambient light is %.1f lx\n'"

 

... das funzt soweit, wenn ich es 'per Hand' aufrufe:

 

Outside temperature is 6,9 °C

Outside humidity is 82,3 %Rh

Ambient light is 0,2 lx

 

 

Ein nun mit crontab -e generierter Cronjob, soll jetzt dieses Script aufrufen, und die Ausgabe in eine Datei umleiten ...

* * * * * /home/lpd/aussenwerte.sh >>/home/lpd/aussenwerte.lst

 

Die Datei 'aussenwerte.lst' wird zwar erzeugt, es sind aber keine Werte drin!

 

Hab' ich was vergessen? Wo steckt der Fehler?

 

Vielen Dank im voraus,

LPD

Geschrieben

versuche bitte explizit stderr und stdout umzuleiten:

* * * * * /home/lpd/aussenwerte.sh >> /home/lpd/aussenwerte.lst 2>&1

 

--m0d

Geschrieben
  • Autor

...vielen Dank für die schnelle Hilfe.

Ok, ich bekomme jetzt immerhin eine Fehlermeldung:

 

In der Zieldatei steht nun:

 


/home/lpd/aussenwerte.sh: Zeile 19: tinkerforge: Kommando nicht gefunden.
/home/lpd/aussenwerte.sh: Zeile 22: tinkerforge: Kommando nicht gefunden.
/home/lpd/aussenwerte.sh: Zeile 25: tinkerforge: Kommando nicht gefunden.

 

... ich habe die Bindings doch richtig geladen?

Warum wird tinkerforge nicht gefunden?

Geschrieben
  • Autor

Oioeueu ... okay, ich bin selbst draufgekommen:

 

Ich habe den Pfad /usr/local/bin/ vor tinkerforge gestellt.

Jetzt trudeln die Werte förmlich hinein ... danke!

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.