#!/bin/sh

# aggiornamento di wp-cli
echo; curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -o /work/scripts/wp-cli.phar
echo; /work/scripts/wp core update --path=/work/wprepository/default

# aggiornamento di sistema
echo; yum upgrade -y

# elimino gli eventuali file php*.conf ripristinati dagli aggiornamenti
rm /etc/httpd/conf.d/php*

service php52-php-fpm restart
service php53-php-fpm restart
service php54-php-fpm restart
service php55-php-fpm restart
service php56-php-fpm restart
service php70-php-fpm restart
service php71-php-fpm restart
service php72-php-fpm restart
service php73-php-fpm restart
service php74-php-fpm restart
service php80-php-fpm restart
service php81-php-fpm restart

CHK=$(service httpd configtest 2>&1)

if [[ "$CHK" == "Syntax OK" ]]
then
       	service httpd restart
else
       	echo "ERRORE NELLA CONFIGURAZIONE HTTP"
fi

service iptables restart
service ip6tables restart
