First commit

This commit is contained in:
adri 2017-12-13 08:32:32 +01:00
commit 17b678f06b
7 changed files with 115 additions and 0 deletions

28
apache Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
if (( $EUID != 0 )); then
echo "Il faut les droit root pour executer la tache"
exit
fi
serviceName=apache2
case "$1" in
start)
echo "démarage d'$serviceName"
action=start
;;
stop)
echo "arrêt de $serviceName"
action=stop
;;
reload)
echo "Reload de $serviceName"
action=reload
;;
*)
echo "erreur $1 non reconnu"
exit 1
;;
esac
service $serviceName $action

8
apacheStart Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
if (( $EUID != 0 )); then
echo "Il faut les droit root pour executer la tache"
exit
fi
SERVICEtoSTART="apache2"
echo "Démarage d'$SERVICEtoSTART"
service "$SERVICEtoSTART" start

8
apacheStop Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
if (( $EUID != 0 )); then
echo "Il faut les droit root pour executer la tache"
exit
fi
SERVICEtoSTOP="apache2"
echo "Démarage d'$SERVICEtoSTOP"
service "$SERVICEtoSTOP" stop

23
mysql Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
if (( $EUID != 0 )); then
echo "Il faut les droit root pour executer la tache"
exit
fi
serviceName=mysql
case "$1" in
start)
echo "démarage de $serviceName"
action=start
;;
stop)
echo "arrêt de $serviceName"
action=stop
;;
*)
echo "erreur $1 non reconnu"
exit 1
;;
esac
service $serviceName $action

8
mysqlStart Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
if (( $EUID != 0 )); then
echo "Il faut les droit root pour executer la tache"
exit
fi
SERVICEtoSTART="mysql"
echo "Démarage d'$SERVICEtoSTART"
service "$SERVICEtoSTART" start

8
mysqlStop Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
if (( $EUID != 0 )); then
echo "Il faut les droit root pour executer la tache"
exit
fi
SERVICEtoSTOP="mysql"
echo "Démarage d'$SERVICEtoSTOP"
service "$SERVICEtoSTOP" stop

32
serveur Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
if (( $EUID != 0 )); then
echo "Il faut les droit root pour executer la tache"
exit 1
fi
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"
if ( service mysql stop && service mysql start )
then echo "Le service mysql à bien redémarer"
else echo "MySQL à rencotré une erreur"
fi
if ( service apache2 $3 &> /dev/null )
then echo "Le service apache à bien été recharger"
else
if ( service apache2 start )
then echo "Le service apache démare"
else
echo "Le service apache a rencontré un problème"
fi
fi
elif [[ $3 == @(start|stop) ]]; then
service $1 $3
service $2 $3
echo "$1 $2 sont $3"
else
echo "$3 non reconnu"
fi
elif [[ $1 == @(apache2|mysql) && $2 == @(start|stop|reload) ]]; then
fi