Update keep_mpm_event.sh

This commit is contained in:
myvesta 2020-06-11 15:25:29 +02:00 committed by GitHub
commit 747b8eea4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,31 +1,41 @@
#!/bin/bash #!/bin/bash
check_grep=$(ps -A | grep -c "apt") switch_to_mpm_event=1
if [ "$check_grep" -eq 0 ]; then
echo "apt is not running" if [ "$1" = 'background' ]; then
echo "cleaning restart.pipe" switch_to_mpm_event=0
check_grep=$(ps -A | grep -c "apt")
if [ "$check_grep" -eq 0 ]; then
echo "=== OK, apt is not running"
echo "=== Cleaning restart.pipe"
sed -i "/keep_mpm_event/d" /usr/local/vesta/data/queue/restart.pipe sed -i "/keep_mpm_event/d" /usr/local/vesta/data/queue/restart.pipe
/usr/local/vesta/bin/v-delete-cron-restart-job /usr/local/vesta/bin/v-delete-cron-restart-job
if [ ! -f "/usr/local/vesta/data/upgrades/keeping-mpm-event-checked" ]; then if [ ! -f "/usr/local/vesta/data/upgrades/keeping-mpm-event-checked" ]; then
touch /usr/local/vesta/data/upgrades/keeping-mpm-event-checked touch /usr/local/vesta/data/upgrades/keeping-mpm-event-checked
echo "mpm_event is not checked" echo "=== OK, mpm_event is not checked"
check_grep=$(grep -c "WEB_SYSTEM='apache2'" /usr/local/vesta/conf/vesta.conf) check_grep=$(grep -c "WEB_SYSTEM='apache2'" /usr/local/vesta/conf/vesta.conf)
if [ "$check_grep" -eq 1 ]; then if [ "$check_grep" -eq 1 ]; then
echo "we have apache" echo "=== OK, we have Apache2"
switch_to_mpm_event=0
release=$(cat /etc/debian_version | tr "." "\n" | head -n1) release=$(cat /etc/debian_version | tr "." "\n" | head -n1)
if [ "$release" -eq 10 ]; then if [ "$release" -eq 10 ]; then
echo "ok, it's deb10" echo "=== OK, it's Debian 10"
switch_to_mpm_event=1 switch_to_mpm_event=1
else else
check_grep=$(/usr/local/vesta/bin/v-list-sys-web-status | grep -c "Server MPM: event") check_grep=$(/usr/local/vesta/bin/v-list-sys-web-status | grep -c "Server MPM: event")
if [ "$check_grep" -eq 1 ]; then if [ "$check_grep" -eq 1 ]; then
echo "ok, it's already mpm_event" echo "=== OK, it's already mpm_event"
switch_to_mpm_event=1 switch_to_mpm_event=1
fi fi
fi fi
if [ "$switch_to_mpm_event" -eq 1 ]; then fi
echo "ok, let's do it" fi
fi
else
echo "=== Script is called by the user"
fi
if [ "$switch_to_mpm_event" -eq 1 ]; then
echo "=== OK, let's ensure mpm_event"
apt-get -y remove libapache2-mod-php7.4 apt-get -y remove libapache2-mod-php7.4
a2dismod ruid2 a2dismod ruid2
a2dismod suexec a2dismod suexec
@ -38,7 +48,5 @@ if [ "$check_grep" -eq 0 ]; then
a2dismod mpm_prefork a2dismod mpm_prefork
a2enmod mpm_event a2enmod mpm_event
service apache2 restart service apache2 restart
fi echo "=== Done!"
fi
fi
fi fi