Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.86 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. IsStopped=`service mysql status | grep stopped`
  4. if [ -z $IsStopped ];
  5.     then
  6.         echo "All is good"
  7.     else
  8.         echo "Service MySQL stopped"
  9.         echo "Some usefull information is:"
  10.         echo disk spase used    `df -h | grep rootfs | tr -s " " | cut -f5 -d' ' | tr -d % | tr -d " "`%
  11.         echo disk inodes used   `df -i | grep rootfs | tr -s " " | cut -f5 -d' ' | tr -d % | tr -d " "`%
  12.         echo All RAM is `free -h | grep Mem | tr -s " " | sed s/'Mem: '// | cut -f1 -d ' '`, used `free -h | grep Mem | tr -s " " | sed s/'Mem: '// | cut -f2 -d ' '`, free `free -h | grep Mem | tr -s " " | sed s/'Mem: '// | cut -f3 -d ' '`
  13.         echo "Try to start MySQL?(y|n)"
  14.         read start
  15.     case $start in
  16.     "y"|"Y") service mysql start;;
  17.     "n"| "N") echo Exiting; exit 0;;
  18.     * ) echo "Invalid input, exiting"; exit 0;;
  19. esac
  20. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement