40 lines
1 KiB
Bash
40 lines
1 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
# FICHIER SOUS CONTROLE D'ANSIBLE, NE PAS MODIFIER DIRECTEMENT
|
||
|
|
||
|
VHOSTS_DIR=/etc/apache2/vhosts.d/
|
||
|
MAINTENANCE_DIR=/var/www/html/rp_maintenance/
|
||
|
|
||
|
TMP=$(mktemp)
|
||
|
|
||
|
|
||
|
while true; do
|
||
|
LISTE_VHOSTS=""
|
||
|
|
||
|
for i in $(ls $VHOSTS_DIR); do
|
||
|
LISTE_VHOSTS="$LISTE_VHOSTS $i"
|
||
|
if [ -f "$MAINTENANCE_DIR/$i" ]; then
|
||
|
LISTE_VHOSTS="$LISTE_VHOSTS (maintenance)"
|
||
|
else
|
||
|
LISTE_VHOSTS="$LISTE_VHOSTS (normal)"
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
echo $LISTE_VHOSTS | xargs dialog --title "Gestion page de maintenance" --menu "Modifier le statut de maintenance du virtualhost :" 0 0 0 2> $TMP
|
||
|
ERR=$?
|
||
|
VHOST=$(cat $TMP)
|
||
|
rm $TMP
|
||
|
|
||
|
if [ "$ERR" == "0" ]; then
|
||
|
if [ -f "$MAINTENANCE_DIR/$VHOST" ]; then
|
||
|
rm $MAINTENANCE_DIR/$VHOST
|
||
|
# dialog --title "Gestion page de maintenance" --msgbox "$VHOST n'est plus en maintenance" 0 0
|
||
|
else
|
||
|
ln -s $MAINTENANCE_DIR/maintenance-generique.html $MAINTENANCE_DIR/$VHOST
|
||
|
# dialog --title "Gestion page de maintenance" --msgbox "$VHOST est mis en maintenance" 0 0
|
||
|
fi
|
||
|
else
|
||
|
exit
|
||
|
fi
|
||
|
done
|