fin backSQL;debut backapache

This commit is contained in:
adri
2017-12-13 15:45:30 +01:00
parent 17b678f06b
commit 3e47cdaeec
5 changed files with 160 additions and 2 deletions

23
serveur
View File

@@ -1,9 +1,13 @@
#!/bin/bash
LOGPATH="./serveur.log"
(
echo "DEBUT $(date +"%D %T")"
if (( $EUID != 0 )); then
echo "Il faut les droit root pour executer la tache"
echo "FIN $(date +"%D %T")"
exit 1
fi
if [[ $# == 3 && $1 == @(apache2|mysql) && $2 == @(apache2|mysql) ]]; then
if [[ $# == 3 && $1 == @(apache2|mysql) && $2 == @(apache2|mysql) ]]; then #
if [ "$3" = "reload" ]
then echo "reload n'est pas une opéopération permise par mysql
Il sera donc arrêter puis démarer"
@@ -28,5 +32,20 @@ if [[ $# == 3 && $1 == @(apache2|mysql) && $2 == @(apache2|mysql) ]]; then
echo "$3 non reconnu"
fi
elif [[ $1 == @(apache2|mysql) && $2 == @(start|stop|reload) ]]; then
case $2 in
start|stop)
service $1 $2
echo "SUCCESS : $1 $2"
;;
reload)
service $1 stop
service $1 start
echo "SUCCESS : $1 $2"
;;
*)
echo "ERROR : $2 non reconnu"
;;
esac
fi
echo "FIN $(date +"%D %T")"
) 2>&2 | tee -a $LOGPATH