Contemplating your information, I switched from thinking about using cron to sometthing more in line with Carlos’ ideas.
This is a first try and it depends upon the fact that you do not type input to the wspr program once it is running in the terminal, apart from the extra Return you have somethimes to give when it crashes.
I gave the script below the name runwspr because then we have a real name to use in the discussions. You can give it of course any name you like.
Create the file with the name runwspr in the bin directory from your home directory with the contents:
#!/bin/bash
# This runs the wspr program in an endless loop.
# Because sometimes a line is read after wspr crashes, it reads from /dev/null.
# To stop the endless loop type Ctrl-C.
while true
do wspr </dev/null
echo "=== Restarting ==="
done
You may alter the line with echo command. It is only there to show that a restart is done, you may even delete it.
Make it executable with
chmod u+x $HOME/bin/runwspr
I tested this, but used a different X program then wspr because I do not have *wspr. *This is what the test shows in the terminal:
henk@boven:~> runwspr
=== Restarting ===
=== Restarting ===
^C
henk@boven:~
I aborted the X program two times by closing it’s window. It restarted immediatly.
I then stopped the whole thing by typing Ctrl-C.
Please try this and test it. You can of course do the tests I did above, but I understand that for a real crash we hav to wait for it to happen. And when you are waiting for it, that will of course not happen (such is live
).
I think that this solution has he following advantages:
- almost the same as you start it now;
- you can still start the old way because nothing is altered to the product;
- easy to see what to script does, even for someone with almost no bash
knowledge.
It has imho the following disadvantage:
- stopping wspr
from it’s GUI window will restart it, you must go to the terminal window and type Ctrl-C. - maybe you find more, please tell them.
Waiting for your test results and you general impression about the solution.