In python3 shell it works as expected:
Code: Select all
$ python3
Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> aika = '21.11.2019 21.44.57'
>>> lampo = '+49.0°C'
>>> f'{aika} {lampo}'
'21.11.2019 21.44.57 +49.0°C'
>>>
Code: Select all
#!/usr/bin/env python3
import subprocess, time
while True:
subprocess.call("/home/arto/bin/lampo.sh")
with open("/tmp/aika") as fa:
aika = fa.readline()
with open("/tmp/lampo") as fl:
lampo = fl.readline()
print(f'{aika} {lampo}')
time.sleep(30)
Code: Select all
21.11.2019 21.54.21
+50.0°C
21.11.2019 21.54.28
+50.0°C
21.11.2019 21.54.37
+49.0°C
21.11.2019 21.54.51
+50.0°C
21.11.2019 21.54.58
+50.0°C
21.11.2019 21.55.07
+50.0°C
21.11.2019 21.55.21
+50.0°C
Code: Select all
#!/bin/bash
if [ -f /tmp/aika ]
then rm /tmp/aika
fi
if [ -f /tmp/lampo ]
then rm /tmp/lampo
fi
if [ -f /tmp/dd ]
then rm /tmp/dd
fi
date >> /tmp/dd
cat /tmp/dd | gawk '{print $2, $3}' >> /tmp/aika
sensors | grep 'Core 3:' | gawk '{printf $3"\n"}' >> /tmp/lampo