I'm writing a deployment script, and I need to rollback if any errors occurred.
Eg:
#!/bin/bash
ssh myapp '
mkdir /some/dir
# check if above command failed, and execute rollback script if needed
'
# or maybe do it from here?
Right now when I execute this script, if mkdir fails, it prints it on my screen and continues execution. I need to catch that error and do something about it.