forked from dokku/dokku-postgres
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pre-start
executable file
·32 lines (26 loc) · 879 Bytes
/
pre-start
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common-functions"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
plugin-pre-start() {
declare APP="$1"
local status
for SERVICE in $(fn-services-list false); do
if ! in_links_file "$SERVICE" "$APP"; then
continue
fi
status="$(service_status "$SERVICE")"
if [[ "$status" == "running" ]]; then
continue
fi
if [[ "$status" == "restarting" ]]; then
dokku_log_warn "$PLUGIN_SERVICE service $SERVICE is restarting and may cause issues with linked app $APP"
continue
fi
dokku_log_warn "$PLUGIN_SERVICE service $SERVICE is not running, issuing service start"
service_start "$SERVICE"
done
}
plugin-pre-start "$@"