I have this constantly running process which POSTs some data collected locally to an endpoint. Now there is some issue in the raspberryPi wifi module and it drops connection frequently. After restarting networking, it starts working again.
So this is what I have right now based on the face that everytime internet disconnects, proc1 starts throwing stderr:
while true; do ./proc1 2>&1 >/dev/null | sudo /etc/init.d/networking restart done &
But this code restarts networking multiple times, not sure why.
What I actually want is something like this:
while true: if proc1 has stderr: sudo /etc/init.d/networking restart; sleep 10;
So my question are:
- How can I convert that pseudocode to bash?
- This is a hack to get around the actual problem of networking drops, how can I debug what’s wrong?