From 30f2925046aed5af310462d965f2c8ec057a5837 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Mon, 25 Nov 2024 14:08:14 -0600 Subject: [PATCH] Expand some scripted command arguments --- scripts/rebuild-cache | 7 ++++--- scripts/reset-php-fpm-opcache | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/rebuild-cache b/scripts/rebuild-cache index f363df96..9742d71d 100755 --- a/scripts/rebuild-cache +++ b/scripts/rebuild-cache @@ -22,8 +22,9 @@ if [ $# -ne 1 ]; then usage fi -# If this script is run by a user without sudo powers, they can be given permission to run this command by creating a file in sudoers.d with: -# MY_USERNAME ALL=(www-data) NOPASSWD: /usr/bin/env SCRIPT_FILENAME=/tmp/rebuild-cache.php REQUEST_METHOD=GET cgi-fcgi -bind -connect * +# If this script is run by a user without sudo powers, they can be given permission to run this command by creating a file in `sudoers.d` with: +# +# MY_USERNAME ALL=(www-data) NOPASSWD: /usr/bin/env SCRIPT_FILENAME=/tmp/rebuild-cache.php REQUEST_METHOD=GET cgi-fcgi -bind -connect * type="$1" @@ -35,5 +36,5 @@ if [ "${type}" = "feeds" ]; then echo "" > /tmp/rebuild-cache.php fi -sudo -u www-data env SCRIPT_FILENAME=/tmp/rebuild-cache.php REQUEST_METHOD=GET cgi-fcgi -bind -connect "/run/php/standardebooks.org.sock" &> /dev/null +sudo --user=www-data env SCRIPT_FILENAME=/tmp/rebuild-cache.php REQUEST_METHOD=GET cgi-fcgi -bind -connect "/run/php/standardebooks.org.sock" &> /dev/null rm /tmp/rebuild-cache.php diff --git a/scripts/reset-php-fpm-opcache b/scripts/reset-php-fpm-opcache index 1f78b39b..5e8bf75d 100755 --- a/scripts/reset-php-fpm-opcache +++ b/scripts/reset-php-fpm-opcache @@ -22,9 +22,10 @@ if [ $# -ne 1 ]; then usage fi -# If this script is run by a user without sudo powers, they can be given for this command by creating a file in sudoers.d with: -# MY_USERNAME ALL=(www-data) NOPASSWD: /usr/bin/env SCRIPT_FILENAME=/tmp/php-fpm-opcache-reset.php REQUEST_METHOD=GET cgi-fcgi -bind -connect * +# If this script is run by a user without sudo powers, they can be given for this command by creating a file in `sudoers.d` with: +# +# MY_USERNAME ALL=(www-data) NOPASSWD: /usr/bin/env SCRIPT_FILENAME=/tmp/php-fpm-opcache-reset.php REQUEST_METHOD=GET cgi-fcgi -bind -connect * echo '' > /tmp/php-fpm-opcache-reset.php -sudo -u www-data env SCRIPT_FILENAME=/tmp/php-fpm-opcache-reset.php REQUEST_METHOD=GET cgi-fcgi -bind -connect "/run/php/$1.sock" &> /dev/null +sudo --user www-data env SCRIPT_FILENAME=/tmp/php-fpm-opcache-reset.php REQUEST_METHOD=GET cgi-fcgi -bind -connect "/run/php/$1.sock" &> /dev/null rm /tmp/php-fpm-opcache-reset.php