Fixes for php-fpm service

This commit is contained in:
Alexey Berezhok
2024-04-08 22:09:24 +03:00
parent 68774baa01
commit e826a68bd3
7 changed files with 101 additions and 8 deletions

39
bin/v-oneshot-service Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/bash
# info: prepare actions befor whole system will start
# options: NONE
#
# example: v-oneshot-service
#
# This function prepares dir structure for such things
# wich deleted on system shoutdown, run as root only
# Includes
# shellcheck source=/etc/hestiacp/hestia.conf
source /etc/hestiacp/hestia.conf
# shellcheck source=/usr/local/hestia/func/main.sh
source $HESTIA/func/main.sh
# load config file
source_conf "$HESTIA/conf/hestia.conf"
# Checking root permissions
if [ "$(id -u)" != '0' ]; then
echo "Error: Script can be run executed only by root"
exit 10
fi
php_DIR="/run/php"
#make php directory in /var/run/directory for php-fpm
if [ -f /etc/redhat-release ]; then
user_apache=$(cat $HESTIA_INSTALL_DIR/php-fpm/multiphp.tpl | grep listen.group | cut -d= -f2 | xargs)
if [ -n "$user_apache" ]; then
if grep "$user_apache" /etc/passwd; then
if grep "$user_apache" /etc/group; then
if [ ! -e "$php_DIR" ]; then
mkdir "$php_DIR"
chmod 755 "$php_DIR"
chown "$user_apache":"$user_apache" "$php_DIR"
fi
fi
fi
fi
fi