Change user run

main
Anthony 2025-06-18 18:51:45 +08:00
parent e4faf53732
commit d31d09fd79
2 changed files with 10 additions and 5 deletions

View File

@ -753,7 +753,7 @@ actions:
message: "${response.out}"
litespeed_metrics:
- cmd[cp]:
user: root
user: litespeed
commands:
- bash /home/litespeed/mbmanager/scripts/litespeed_metrics.sh
- return:

View File

@ -3,15 +3,20 @@
# LiteSpeed Cache Critical Metrics Monitor
# Captures the 4 most important performance metrics
# Check if WP-CLI is available
if [ ! -f "/home/litespeed/bin/wp" ]; then
echo '{"error": "WP-CLI not found at /home/litespeed/bin/wp"}'
# Find WP-CLI location
WP_CLI_PATH=""
if [ -f "/home/litespeed/bin/wp" ]; then
WP_CLI_PATH="/home/litespeed/bin/wp"
elif command -v wp >/dev/null 2>&1; then
WP_CLI_PATH="wp"
else
echo '{"error": "WP-CLI not found. Please ensure WP-CLI is installed and accessible."}'
exit 1
fi
# Function to run WP-CLI commands
run_wp_command() {
/home/litespeed/bin/wp --path=/var/www/webroot/ROOT "$@" 2>/dev/null
$WP_CLI_PATH --path=/var/www/webroot/ROOT "$@" 2>/dev/null
}
# Initialize JSON output