!/bin/bash
ip -details -statistics link show can0 | grep BUS-OFF > NULL
if [ $? = "0" ]
then
ip link set can0 down
ip link set can0 up type can bitrate 250000
systemctl start publish-py.service &
echo "$(date) : BUS-OFF restart" >> /var/log/home.log
fi
I have another long working script
some code
target_port_down = 0
#print(msg.topic+" "+str(msg.payload))
topic = msg.topic
echo (f"topic. [topic]") >> /var/log/sl.log
# Stehlampen
much more code
msg.topicwhere I added the line with the echo, and now it get an error at the “>>”
Do not understand it, There are a lot of samples on the net doing the same.
Yes you are right, the first is bash, the second is Python. I took a line of bash in Python. I am an idiot. so I have to open a file write to it and close it.