Create the proper init file in a distribution-agnostic way

From http://unix.stackexchange.com/a/164092/105389
This commit is contained in:
Jose Diaz-Gonzalez committed 2016-01-02 04:08:54 -05:00
1 parent bb525a3cf1
commit 5a74d5c247
1 file changed
+4 -6
+4 -6
View File
@@ -11,8 +11,7 @@ fi
# temporary hack for https://github.com/dokku/dokku/issues/82 # temporary hack for https://github.com/dokku/dokku/issues/82
# redeploys all apps after a reboot # redeploys all apps after a reboot
case "$DOKKU_DISTRO" in if [[ $(/sbin/init --version 2> /dev/null) =~ upstart ]]; then
ubuntu)
cat<<EOF > /etc/init/dokku-redeploy.conf cat<<EOF > /etc/init/dokku-redeploy.conf
description "Dokku app redeploy service" description "Dokku app redeploy service"
@@ -23,9 +22,9 @@ script
sudo -i -u dokku /usr/local/bin/dokku ps:restore sudo -i -u dokku /usr/local/bin/dokku ps:restore
end script end script
EOF EOF
;; fi
debian|opensuse) if [[ $(systemctl 2> /dev/null) =~ -\.mount ]]; then
cat<<EOF > /etc/systemd/system/dokku-redeploy.service cat<<EOF > /etc/systemd/system/dokku-redeploy.service
[Unit] [Unit]
Description=Dokku app redeploy service Description=Dokku app redeploy service
@@ -42,8 +41,7 @@ EOF
if command -v systemctl &>/dev/null; then if command -v systemctl &>/dev/null; then
systemctl enable dokku-redeploy systemctl enable dokku-redeploy
fi fi
;; fi
esac
mkdir -p /etc/update-motd.d mkdir -p /etc/update-motd.d
cat<<EOF > /etc/update-motd.d/99-dokku cat<<EOF > /etc/update-motd.d/99-dokku