maintenance.sh 813 B

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