Reputation:
I'm trying to give a mqtt call the output of cat
as value; however it is important that the cat
call gets killed immediatly after putting something in the variable, since the targeted file has to emtpy itself and only does so, when not being read. But currently the call doesn't get killed. When I kill it manually by killing it's PID, it runs the rest of the code smoothly but prints out "ash: you need to specify whom to kill
.
Here is the code:
#!/bin/ash
while true;do
rs=$( cat /dev/rs232 & )
pid=$!
kill ${pid}
mosquitto_pub -h IP -m "$rs" -t rs_test/message
done
Using kill $( pgrep cat )
insteda of pid=$!
and kill ${pid}
seems to also not work
Upvotes: 0
Views: 1930