-
Notifications
You must be signed in to change notification settings - Fork 6
/
dependencies
executable file
·37 lines (31 loc) · 984 Bytes
/
dependencies
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
33
34
35
36
37
#!/usr/bin/env bash
# Installs monit for the current plugin
# Supports Ubuntu
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
install_monit() {
case "$DOKKU_DISTRO" in
debian|ubuntu)
export DEBIAN_FRONTEND=noninteractive
apt-get install --force-yes -qq -y monit
;;
*)
echo "Unsupported distribution. Please install Monit and run sudo dokku plugin:install-dependencies again."
return 1
esac
}
enable_systemd_unit() {
local plugin_path="$PLUGIN_AVAILABLE_PATH/monit"
if hash systemctl 2> /dev/null; then
cp -f "$plugin_path/dokku-monit.service" /etc/systemd/system/
systemctl reenable dokku-monit.service
systemctl start dokku-monit.service
else
echo >&2 "Could not install systemd unit because systemctl was not found."
return 1
fi
}
if hash monit 2> /dev/null; then
enable_systemd_unit
else
install_monit && enable_systemd_unit
fi