From c52f0fed60cdb243ebbd792257d950706756e1df Mon Sep 17 00:00:00 2001 From: Mika Date: Tue, 9 Jul 2024 14:14:51 +0200 Subject: [PATCH] env: add start.sh this script easily lets you start the compose file and backend in 1 sh script and stops it once it recieves a ctrl+c --- start.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 start.sh diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..e74ed48 --- /dev/null +++ b/start.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +terminate_script() { + echo "Stopping the script and killing background processes..." + + docker compose down + + # Kill all child processes (background processes) + pkill -P $$ # $$ refers to the PID of the script itself + + exit 1 +} + +trap 'terminate_script' INT TERM HUP + +# Start the first process +$(docker compose up -d) + + +# Start the second process +$(cargo dev) + +