I'm running an embedded application on a RPI. I am planning to have a script restart it if it crashes. But I'd like to see the crash info. So I see how to redirect stderr to a file to append the latest crash details but I would like to add a time tag for each crash situation. 1) Is there an easy way to do this? I wrote a simple python program to write out a time tag followed by reading from stdin and echoing the data out. 2) How can I redirect just the stderr output to my program? I tried the following command line but it doesn't work. Not sure proper way to do this.
sudo python3 TestRedirect.py 2> | sudo python3 TimeTagErrors.py
Maybe the answer to question 1 will make question 2 not necessary.