feat: switch to systemctl for interacting with the nginx init process

This commit is contained in:
Jose Diaz-Gonzalez
2022-11-28 01:52:27 -05:00
parent 5fed0c45ac
commit a8bc8044e4
3 changed files with 5 additions and 0 deletions

View File

@@ -75,6 +75,8 @@ trigger-nginx-vhosts-install() {
ubuntu)
if [[ -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"
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"
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"
fi

View File

@@ -132,6 +132,8 @@ fn-nginx-vhosts-nginx-init-cmd() {
# support docker-based installations
if [[ -x /usr/bin/sv ]]; then
sudo /usr/bin/sv "$CMD" "$NGINX_INIT_NAME"
elif [[ -x /usr/bin/systemctl ]]; then
sudo /usr/bin/systemctl "$CMD" "$NGINX_INIT_NAME"
else
sudo "/etc/init.d/$NGINX_INIT_NAME" "$CMD"
fi