Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. root@wyswietlacz(ro):/mnt/ramdisk# more /home/pi/wyswietlacz/automatyka.py
  2. import os
  3. from time import *
  4. from subprocess import call
  5.  
  6. timer = 0
  7. call("sudo /usr/bin/rdate -s ntp.task.gda.pl", shell=True)
  8. while True:
  9. sleep(5)
  10. timer = timer + 1
  11. #wykonanie sekwencji komend i pobranie potrzebnych zmiennych
  12. if timer == 1:
  13. call("/usr/bin/python /home/pi/wyswietlacz/bme280_temperature.py", shell = Tru
  14. e)
  15. timer = timer + 1
  16. if timer == 2:
  17. call("/usr/bin/python /home/pi/wyswietlacz/esp_hubert.py", shell = True)
  18. timer = timer + 1
  19. if timer == 3:
  20. call("/usr/bin/python /home/pi/wyswietlacz/esp_zew.py", shell = True)
  21. timer = timer + 1
  22. if timer == 4:
  23. call("/bin/cat /sys/class/thermal/thermal_zone0/temp > /mnt/ramdisk/temp_cpu",
  24. shell = True)
  25. timer = timer + 1
  26. if timer == 5:
  27. call("/usr/bin/free | grep Mem | awk '{print $4/$2 * 100.0}' > /mnt/ramdisk/ra
  28. m_free", shell = True)
  29. timer = timer + 1
  30. if timer == 6:
  31. call("/bin/df -h |grep root > /mnt/ramdisk/sd_card", shell = True)
  32. timer = timer + 1
  33. if timer == 7:
  34. call("x=$(cat /proc/uptime|awk '{print $1}') ; echo $x > /mnt/ramdisk/uptime",
  35. shell = True)
  36. timer = timer + 1
  37. if timer == 8:
  38. call("/bin/cpu_utilization > /mnt/ramdisk/cpu_usage", shell = True)
  39. print(timer)
  40. timer = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement