24 lines
397 B
Bash
24 lines
397 B
Bash
|
#!/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)
|
||
|
|
||
|
|