I have binary file that I run like env SOME_VARS=some_values ./my_binary

Is there a way that when this execution ends (be it that it ends correctly or it crashes or it gets killed, whatever), it gets started again with the same environment variables?


You didn't specify platform, I will assume Linux. In which case the Restart and Environment options of a systemd service unit could work nicely. These can be defined in user specific units so it can be run as a non privileged user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.