Files
VPS-scripts_Web-V2/Scripts/Php-EnableSessionsToRam.sh

25 lines
1.1 KiB
Bash

#!/bin/bash
#######################################################
# @description: #
# Setup the PHP session folder as a Ramdisk / tmpfs #
# This will store session info in memory #
# #
# @author: Bram Prieshof #
#######################################################
#sysCheck
if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi
if [ ! -f "/etc/ICTM/phpvar.list" ] ; then bash <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/GeneratePhplist.sh) ; fi
source /etc/ICTM/phpvar.list
#Stop php service
systemctl stop $phpFPMService
#Reset php session folder
rm -rf /var/lib/php/sessions
mkdir -p /var/lib/php/sessions
#Create memdisk/Tmpfs and mount it
echo "tmpfs /var/lib/php/sessions tmpfs size=32m,uid=$(id -u www-data),gid=$(id -g www-data),mode=0773 0 0" >> /etc/fstab
mount -a
#start php service
systemctl stop $phpFPMService