#!/bin/bash FRONT_PATH="/var/www/opentalent-admin/prod" MAINTENANCE_PATH="/var/opentalent/git/devops/maintenance" echo "Maintenance ON ou OFF ?" read response if [ $response == 'ON' ]; then echo "Message de fin de maintenance (exemple : le vendredi 16 décembre à 8h00) ?" read message sed -i "s/.*<\/span>/${message}<\/span>/g" ${MAINTENANCE_PATH}/maintenance.html cp -f ${MAINTENANCE_PATH}/.htaccess_maintenance_on ${FRONT_PATH}/.htaccess ssh -t root@prod-back "touch /tmp/MAINTENANCE" echo "Maintenance ON" elif [ $response == 'OFF' ]; then cp -f ${MAINTENANCE_PATH}/.htaccess_maintenance_off ${FRONT_PATH}/.htaccess ssh -t root@prod-back "rm /tmp/MAINTENANCE" echo "Maintenance OFF" else echo "Le choix doit être ON ou OFF" fi