#!/bin/bash # Make sure `/data/db` directory exists even with persistent storage mkdir -p /data/db # If app crashed, mongo didn't stop gracefully. Remove all the old *.lock files find /data/db -name "*.lock" -type f -exec rm -f {} \; # Start the local Mongo database mongod & # Start the chat-ui process pm2 start /app/build/index.js -i $CPU_CORES --no-daemon & # Wait for any process to exit wait -n # Exit with status of process that exited first exit $?