Restart with supervisor after crash

We are running Metabase on a very small EC2 instance and sometimes it stops, and the log file show this: “OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000e1ed8000, 11776000, 0) failed; error=‘Cannot allocate memory’ (errno=12)”

We are running Metabase with supervisor, but to restart it is needed to exec before the java -jar metabase.jar migrate release-locks command.

Anyone know how to do that?