Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- if [ $USER = "root" ]
- then
- /etc/init.d/apache2 start
- else
- echo "Vous n'etes pas root."
- fi
- #! /bin/bash
- if [ $USER = "root" ]
- then
- /etc/init.d/apache2 stop
- else
- echo "Vous n'etes pas root."
- fi
- #! /bin/bash
- if [ $USER = "root" ]
- then
- if [ $# -ge 1 ]
- then
- case $1 in
- "start")
- /etc/init.d/apache2 start
- ;;
- "stop")
- /etc/init.d/apache2 stop
- ;;
- "restart")
- /etc/init.d/apache2 restart
- ;;
- "status")
- /etc/init.d/apache2 status
- ;;
- *)
- echo "Parametre invalide"
- ;;
- esac
- else
- echo "Veuillez entrer un paramètre"
- else
- echo "Vous n'etes pas root."
- fi
- #! /bin/bash
- if [ $# -ge 1 ]
- then
- if [ ! -d $1 ]
- then
- echo "Le dossier n'existe pas, il va etre cree."
- mkdir $1
- if [ ! -d $1 ]
- then
- exit
- fi
- fi
- f="$1/backupHome - `date`.tar.gz"
- tar -zcf "$f" /home
- echo "Sauvegarde réussite"
- else
- echo "Veuillez entrer un chemin d'accès."
- fi
- #! /bin/bash
- if [ $# -ge 1 ]
- then
- if [ ! -d $1 ]
- then
- echo -e "Le dossier n'existe pas, il va etre cree."
- mkdir $1
- if [ ! -d $1 ]
- then
- exit
- fi
- fi
- echo -e "User :"
- read user
- echo -e "MDP"
- read password
- f="$1/backupMySQL - `date`.sql"
- mysqldump -u $user --password=$password -h localhost --all-databases > "$f"
- if [ -s "$f" ]
- then
- echo -e "Sauvegarde faite"
- else
- echo -e "Sauvegarde rate"
- fi
- else
- echo -e "Veuillez entrer un chemin d'accès."
- fi
- #! /bin/bash
- if [ $USER = "root" ]
- then
- if [ $# -ge 1 ]
- then
- case $1 in
- "start")
- /etc/init.d/mysql start
- ;;
- "stop")
- /etc/init.d/mysql stop
- ;;
- "restart")
- /etc/init.d/mysql restart
- ;;
- "status")
- /etc/init.d/mysql status
- ;;
- *)
- echo "Parametre invalide"
- ;;
- esac
- else
- echo "Veuillez entrer un paramètre"
- else
- echo "Vous n'etes pas root."
- fi
- #! /bin/bash
- if [ $USER = "root" ]
- then
- /etc/init.d/mysql start
- else
- echo "Vous n'etes pas root"
- fi
- #! /bin/bash
- if [ $USER = "root" ]
- then
- /etc/init.d/mysql stop
- else
- echo "Vous n'etes pas root"
- fi
- #! /bin/bash
- if [ $USER = "root" ]
- then
- if [ $# -ge 2 ]
- then
- case $1 in
- "mysql")
- case $2 in
- "start")
- /etc/init.d/mysql start
- echo $(echo "MySQL start on") $(date) >> /var/log/mysql.log
- ;;
- "stop")
- /etc/init.d/mysql stop
- echo $(echo "MySQL start on") $(date) >> /var/log/mysql.log
- ;;
- "restart")
- /etc/init.d/mysql restart
- echo $(echo "MySQL start on") $(date) >> /var/log/mysql.log
- ;;
- "status")
- /etc/init.d/mysql status
- echo $(echo "MySQL start on") $(date) >> /var/log/mysql.log
- ;;
- *)
- echo "Parametre invalide"
- ;;
- esac
- ;;
- "apache")
- case $2 in
- "start")
- /etc/init.d/apache start
- echo $(echo "Apache start on") $(date) >> /var/log/apache.log
- ;;
- "stop")
- /etc/init.d/apache stop
- echo $(echo "Apache stop on") $(date) >> /var/log/apache.log
- ;;
- "restart")
- /etc/init.d/apache restart
- echo $(echo "Apache restart on") $(date) >> /var/log/apache.log
- ;;
- "status")
- /etc/init.d/apache status
- echo $(echo "Apache status on") $(date) >> /var/log/apache.log
- ;;
- *)
- echo "Parametre invalide"
- ;;
- esac
- ;;
- *)
- echo "Parametre invalide"
- ;;
- esac
- else
- echo "Nombre de paramètres invalides"
- fi
- else
- echo "Vous n'etes pas root."
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement