https://github.com/Petelin/restart
go install github.com/Petelin/restart/restart
then use restart "<bash command>"
this is equal to run bash -c "<bash command>"
but with auto restart if command exit.
Main idea is create a subprocess to run the real job. the main process monitor it, restart it if err happen, or kill it after a while. Add what ever you what from this idea.
we all know write a nevery stoped program is almost impossiple. if we can promiss our program(like a spider) can work for a wheal, then we restart it if it crash, that will make us happy.
but i just want a simple main
bin file.
You can write a Runxxx function, i like to merge your RP. enjoy!