So, this one comes up a lot too. So you wanna run a process, and you don’t want it to crap out, you don’t want PIDCrap or any other lunatic solution that simply doesn’t work 100%. Well, welcome to until.
I’ve been executing a ruby script that does some stuff with fog.
but, it keeps crapping out with lots of errors
I figured crapout no more and nabbed this handy snippet, credit to good ole stackoverflow
until ruby my-fog-cloud-files-container-deleter-thingy.rb; do echo "Server 'myserver' crashed with exit code $?. Respawning.." >&2 sleep 1 done
Now when it craps out, it continues where it left off.. nice, simple, elegant.
I don’t know what kind of error handling swiftly and pyrax has available in built, but this is a nice way to do it. Theoretically this oneliner might be of use for turbolift as well as any other batch like job which might end prematurely before the code deploy finishes. I wish cloud init had something like this