added notify to all needed in unraid essentials
This commit is contained in:
@@ -58,33 +58,33 @@ apply_php_max_children() {
|
||||
if [[ "$DRY_RUN" == true ]]; then
|
||||
warn "DRY RUN — would set pm.max_children = $PHP_MAX_CHILDREN in $PHP_CONF"
|
||||
warn "DRY RUN — would restart PHP-FPM service"
|
||||
return
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Verify config file exists before attempting changes
|
||||
if [[ ! -f "$PHP_CONF" ]]; then
|
||||
error "PHP config file not found: $PHP_CONF"
|
||||
exit 1
|
||||
return 1
|
||||
fi
|
||||
|
||||
info "Applying pm.max_children = $PHP_MAX_CHILDREN..."
|
||||
|
||||
if sed -i "s/^pm\.max_children.*/$target/" "$PHP_CONF"; then
|
||||
success "Config updated"
|
||||
else
|
||||
if ! sed -i "s/^pm\.max_children.*/$target/" "$PHP_CONF"; then
|
||||
error "Failed to update PHP config: $PHP_CONF"
|
||||
exit 1
|
||||
return 1
|
||||
fi
|
||||
|
||||
success "Config updated"
|
||||
|
||||
info "Restarting PHP-FPM..."
|
||||
|
||||
if /etc/rc.d/rc.php-fpm restart; then
|
||||
success "PHP-FPM restarted"
|
||||
else
|
||||
if ! /etc/rc.d/rc.php-fpm restart; then
|
||||
error "PHP-FPM restart failed"
|
||||
exit 1
|
||||
return 1
|
||||
fi
|
||||
|
||||
success "PHP-FPM restarted"
|
||||
|
||||
# Verify the value was applied correctly
|
||||
local current
|
||||
current=$(grep -E "^pm\.max_children" "$PHP_CONF" || true)
|
||||
@@ -95,6 +95,8 @@ apply_php_max_children() {
|
||||
else
|
||||
warn "Could not verify configuration value — check $PHP_CONF manually"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------------------------
|
||||
@@ -111,7 +113,8 @@ echo ""
|
||||
|
||||
START=$(date +%s)
|
||||
|
||||
apply_php_max_children
|
||||
PHP_SUCCESS=false
|
||||
apply_php_max_children && PHP_SUCCESS=true
|
||||
|
||||
END=$(date +%s)
|
||||
|
||||
@@ -125,7 +128,14 @@ echo "$ICON_PHP Max Children: $PHP_MAX_CHILDREN"
|
||||
echo "$ICON_TIME Duration: $(format_duration $((END - START)))"
|
||||
if [[ "$DRY_RUN" == true ]]; then
|
||||
echo "$ICON_WARN Status: DRY RUN — no changes made"
|
||||
else
|
||||
elif [[ "$PHP_SUCCESS" == true ]]; then
|
||||
echo "$ICON_DONE Status: $ICON_SUCCESS DONE"
|
||||
notify "PHP-FPM max_children set to $PHP_MAX_CHILDREN on $(hostname)" "PHP-FPM" "normal"
|
||||
else
|
||||
echo "$ICON_ERROR Status: $ICON_ERROR FAILED"
|
||||
notify "PHP-FPM config update failed on $(hostname)" "PHP-FPM" "warning"
|
||||
fi
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
[[ "$PHP_SUCCESS" == false ]] && exit 1
|
||||
exit 0
|
||||
Reference in New Issue
Block a user