Advertisement
Guest User

Untitled

a guest
Dec 7th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. #! /bin/bash
  2. if [ $USER = "root" ]
  3. then
  4. /etc/init.d/apache2 start
  5. else
  6. echo "Vous n'etes pas root."
  7. fi
  8.  
  9.  
  10. #! /bin/bash
  11. if [ $USER = "root" ]
  12. then
  13. /etc/init.d/apache2 stop
  14. else
  15. echo "Vous n'etes pas root."
  16. fi
  17.  
  18.  
  19. #! /bin/bash
  20. if [ $USER = "root" ]
  21. then
  22. if [ $# -ge 1 ]
  23. then
  24. case $1 in
  25. "start")
  26. /etc/init.d/apache2 start
  27. ;;
  28. "stop")
  29. /etc/init.d/apache2 stop
  30. ;;
  31. "restart")
  32. /etc/init.d/apache2 restart
  33. ;;
  34. "status")
  35. /etc/init.d/apache2 status
  36. ;;
  37. *)
  38. echo "Parametre invalide"
  39. ;;
  40. esac
  41. else
  42. echo "Veuillez entrer un paramètre"
  43. else
  44. echo "Vous n'etes pas root."
  45. fi
  46.  
  47.  
  48. #! /bin/bash
  49. if [ $# -ge 1 ]
  50. then
  51. if [ ! -d $1 ]
  52. then
  53. echo "Le dossier n'existe pas, il va etre cree."
  54. mkdir $1
  55. if [ ! -d $1 ]
  56. then
  57. exit
  58. fi
  59. fi
  60.  
  61. f="$1/backupHome - `date`.tar.gz"
  62. tar -zcf "$f" /home
  63. echo "Sauvegarde réussite"
  64.  
  65. else
  66. echo "Veuillez entrer un chemin d'accès."
  67. fi
  68.  
  69.  
  70. #! /bin/bash
  71. if [ $# -ge 1 ]
  72. then
  73. if [ ! -d $1 ]
  74. then
  75. echo -e "Le dossier n'existe pas, il va etre cree."
  76. mkdir $1
  77. if [ ! -d $1 ]
  78. then
  79. exit
  80. fi
  81. fi
  82.  
  83. echo -e "User :"
  84. read user
  85. echo -e "MDP"
  86. read password
  87.  
  88. f="$1/backupMySQL - `date`.sql"
  89. mysqldump -u $user --password=$password -h localhost --all-databases > "$f"
  90.  
  91. if [ -s "$f" ]
  92. then
  93. echo -e "Sauvegarde faite"
  94. else
  95. echo -e "Sauvegarde rate"
  96. fi
  97.  
  98. else
  99. echo -e "Veuillez entrer un chemin d'accès."
  100. fi
  101.  
  102.  
  103. #! /bin/bash
  104. if [ $USER = "root" ]
  105. then
  106. if [ $# -ge 1 ]
  107. then
  108. case $1 in
  109. "start")
  110. /etc/init.d/mysql start
  111. ;;
  112. "stop")
  113. /etc/init.d/mysql stop
  114. ;;
  115. "restart")
  116. /etc/init.d/mysql restart
  117. ;;
  118. "status")
  119. /etc/init.d/mysql status
  120. ;;
  121. *)
  122. echo "Parametre invalide"
  123. ;;
  124. esac
  125. else
  126. echo "Veuillez entrer un paramètre"
  127. else
  128. echo "Vous n'etes pas root."
  129. fi
  130.  
  131.  
  132. #! /bin/bash
  133. if [ $USER = "root" ]
  134. then
  135. /etc/init.d/mysql start
  136. else
  137. echo "Vous n'etes pas root"
  138. fi
  139.  
  140.  
  141. #! /bin/bash
  142. if [ $USER = "root" ]
  143. then
  144. /etc/init.d/mysql stop
  145. else
  146. echo "Vous n'etes pas root"
  147. fi
  148.  
  149.  
  150. #! /bin/bash
  151. if [ $USER = "root" ]
  152. then
  153. if [ $# -ge 2 ]
  154. then
  155. case $1 in
  156. "mysql")
  157. case $2 in
  158. "start")
  159. /etc/init.d/mysql start
  160. echo $(echo "MySQL start on") $(date) >> /var/log/mysql.log
  161. ;;
  162. "stop")
  163. /etc/init.d/mysql stop
  164. echo $(echo "MySQL start on") $(date) >> /var/log/mysql.log
  165. ;;
  166. "restart")
  167. /etc/init.d/mysql restart
  168. echo $(echo "MySQL start on") $(date) >> /var/log/mysql.log
  169. ;;
  170. "status")
  171. /etc/init.d/mysql status
  172. echo $(echo "MySQL start on") $(date) >> /var/log/mysql.log
  173. ;;
  174. *)
  175. echo "Parametre invalide"
  176. ;;
  177. esac
  178. ;;
  179. "apache")
  180. case $2 in
  181. "start")
  182. /etc/init.d/apache start
  183. echo $(echo "Apache start on") $(date) >> /var/log/apache.log
  184. ;;
  185. "stop")
  186. /etc/init.d/apache stop
  187. echo $(echo "Apache stop on") $(date) >> /var/log/apache.log
  188. ;;
  189. "restart")
  190. /etc/init.d/apache restart
  191. echo $(echo "Apache restart on") $(date) >> /var/log/apache.log
  192. ;;
  193. "status")
  194. /etc/init.d/apache status
  195. echo $(echo "Apache status on") $(date) >> /var/log/apache.log
  196. ;;
  197. *)
  198. echo "Parametre invalide"
  199. ;;
  200. esac
  201. ;;
  202. *)
  203. echo "Parametre invalide"
  204. ;;
  205. esac
  206. else
  207. echo "Nombre de paramètres invalides"
  208. fi
  209. else
  210. echo "Vous n'etes pas root."
  211. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement