fix problem when sv and systemctl exists at the same time in ubuntu, core command related dokku nginx plugin will fail.
This will happend when an ubuntu server upgrade from early version.
This commit is contained in:
1 parent
e6953d60e9
commit
ff2d60003d
2 files changed
+6
-6
No files matched your search
@@ -77,10 +77,10 @@ trigger-nginx-vhosts-install() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
ubuntu)
|
ubuntu)
|
||||||
if [[ -x /usr/bin/sv ]]; then
|
if [[ -x /usr/bin/systemctl ]]; then
|
||||||
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/sv enable $NGINX_INIT_NAME, /usr/bin/sv disable $NGINX_INIT_NAME, /usr/bin/sv reload $NGINX_INIT_NAME, /usr/bin/sv start $NGINX_INIT_NAME, /usr/bin/sv stop $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE"
|
|
||||||
elif [[ -x /usr/bin/systemctl ]]; then
|
|
||||||
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl enable $NGINX_INIT_NAME, /usr/bin/systemctl disable $NGINX_INIT_NAME, /usr/bin/systemctl reload $NGINX_INIT_NAME, /usr/bin/systemctl start $NGINX_INIT_NAME, /usr/bin/systemctl stop $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE"
|
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl enable $NGINX_INIT_NAME, /usr/bin/systemctl disable $NGINX_INIT_NAME, /usr/bin/systemctl reload $NGINX_INIT_NAME, /usr/bin/systemctl start $NGINX_INIT_NAME, /usr/bin/systemctl stop $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE"
|
||||||
|
elif [[ -x /usr/bin/sv ]]; then
|
||||||
|
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/sv enable $NGINX_INIT_NAME, /usr/bin/sv disable $NGINX_INIT_NAME, /usr/bin/sv reload $NGINX_INIT_NAME, /usr/bin/sv start $NGINX_INIT_NAME, /usr/bin/sv stop $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE"
|
||||||
else
|
else
|
||||||
echo "%dokku ALL=(ALL) NOPASSWD:/etc/init.d/$NGINX_INIT_NAME enable, /etc/init.d/$NGINX_INIT_NAME disable, /etc/init.d/$NGINX_INIT_NAME reload, /etc/init.d/$NGINX_INIT_NAME start, /etc/init.d/$NGINX_INIT_NAME stop, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE"
|
echo "%dokku ALL=(ALL) NOPASSWD:/etc/init.d/$NGINX_INIT_NAME enable, /etc/init.d/$NGINX_INIT_NAME disable, /etc/init.d/$NGINX_INIT_NAME reload, /etc/init.d/$NGINX_INIT_NAME start, /etc/init.d/$NGINX_INIT_NAME stop, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -149,10 +149,10 @@ fn-nginx-vhosts-nginx-init-cmd() {
|
|||||||
|
|
||||||
ubuntu)
|
ubuntu)
|
||||||
# support docker-based installations
|
# support docker-based installations
|
||||||
if [[ -x /usr/bin/sv ]]; then
|
if [[ -x /usr/bin/systemctl ]]; then
|
||||||
sudo /usr/bin/sv "$CMD" "$NGINX_INIT_NAME"
|
|
||||||
elif [[ -x /usr/bin/systemctl ]]; then
|
|
||||||
sudo /usr/bin/systemctl "$CMD" "$NGINX_INIT_NAME"
|
sudo /usr/bin/systemctl "$CMD" "$NGINX_INIT_NAME"
|
||||||
|
elif [[ -x /usr/bin/sv ]]; then
|
||||||
|
sudo /usr/bin/sv "$CMD" "$NGINX_INIT_NAME"
|
||||||
elif [[ "$CMD" == "enable" ]] || [[ "$CMD" == "disable" ]]; then
|
elif [[ "$CMD" == "enable" ]] || [[ "$CMD" == "disable" ]]; then
|
||||||
dokku_log_warn "Running $CMD is not possible for init.d managed services"
|
dokku_log_warn "Running $CMD is not possible for init.d managed services"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in new issue
Block a user