yt-dlp-bot/start.sh

21 lines
385 B
Bash
Raw Normal View History

2022-02-04 06:21:27 +08:00
#!/bin/bash
2022-06-14 04:46:54 +08:00
check_reachability() {
while ! nc -z "$1" "${!2}"
2022-02-04 06:21:27 +08:00
do
2022-06-14 04:46:54 +08:00
echo "Waiting for $3 to be reachable on port ${!2}"
2022-02-04 06:21:27 +08:00
sleep 1
done
2022-06-14 04:46:54 +08:00
echo "Connection to $3 on port ${!2} verified"
return 0
}
2022-02-04 06:21:27 +08:00
2022-06-14 04:46:54 +08:00
wait_for_services_to_be_reachable() {
check_reachability rabbitmq RABBITMQ_PORT RabbitMQ
check_reachability postgres POSTGRES_PORT PostgreSQL
}
wait_for_services_to_be_reachable
2022-02-04 06:21:27 +08:00
exit 0