Make server blocks orange when starting

master
Jonathan Hodgson 7 years ago
parent c618cf604f
commit c336d51b07
  1. 17
      i3/blocks/apache
  2. 11
      i3/blocks/mysql

@ -5,11 +5,14 @@ STATUS=$($LAMPP status 2> /dev/null)
APACHE=$(echo "$STATUS" | grep -i apache | grep -io not > /dev/null && echo "down" || echo "up") APACHE=$(echo "$STATUS" | grep -i apache | grep -io not > /dev/null && echo "down" || echo "up")
COLOUR=""
function toggleApache(){ function toggleApache(){
if [ $APACHE = "up" ]; then if [ $APACHE = "up" ]; then
gksudo $LAMPP stopapache gksudo $LAMPP stopapache > /dev/null
else else
gksudo $LAMPP startapache gksudo $LAMPP startapache > /dev/null
COLOUR="#FF8000"
fi fi
} }
@ -26,10 +29,12 @@ case $BLOCK_BUTTON in
3) toggleAll ;; 3) toggleAll ;;
esac esac
if [ "$APACHE" = "up" ]; then if [ -z "$COLOUR" ]; then
COLOUR="#00FF00" if [ "$APACHE" = "up" ]; then
else COLOUR="#00FF00"
COLOUR="#FF0000" else
COLOUR="#FF0000"
fi
fi fi
echo "Apache" echo "Apache"

@ -5,11 +5,14 @@ STATUS=$($LAMPP status 2> /dev/null)
MYSQL=$(echo "$STATUS" | grep -i mysql | grep -io not > /dev/null && echo "down" || echo "up") MYSQL=$(echo "$STATUS" | grep -i mysql | grep -io not > /dev/null && echo "down" || echo "up")
COLOUR=""
function toggleMysql(){ function toggleMysql(){
if [ $MYSQL = "up" ]; then if [ $MYSQL = "up" ]; then
gksudo $LAMPP stopmysql gksudo $LAMPP stopmysql
else else
gksudo $LAMPP startmysql gksudo $LAMPP startmysql
COLOUR="#FF8000"
fi fi
} }
@ -32,6 +35,14 @@ else
COLOUR="#FF0000" COLOUR="#FF0000"
fi fi
if [ -z "$COLOUR" ]; then
if [ "$APACHE" = "up" ]; then
COLOUR="#00FF00"
else
COLOUR="#FF0000"
fi
fi
echo "MySQL" echo "MySQL"
echo "" echo ""
echo "$COLOUR" echo "$COLOUR"

Loading…
Cancel
Save