UI_PORT=3321

cleanup() {
    echo "Stopping all running processes..."
    pkill -P $$
    exit 0
}
trap cleanup SIGINT SIGTERM

wasmedge --dir ./crabmail:./crabmail ./crabmail.wasm -h -c /crabmail/crabmail.conf -d /crabmail/result -m /crabmail/mailboxes &
./sonic/sonic -c ./sonic/config.cfg &
./UI/server $UI_PORT &
xdg-open http://127.0.0.1:$UI_PORT &

wait