You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

42 lines
670 B

#!/usr/bin/sh
LAMPP='/opt/lampp/lampp'
STATUS=$($LAMPP status 2> /dev/null)
APACHE=$(echo "$STATUS" | grep -i apache | grep -io not > /dev/null && echo "down" || echo "up")
COLOUR=""
function toggleApache(){
if [ $APACHE = "up" ]; then
gksudo $LAMPP stopapache > /dev/null
else
gksudo $LAMPP startapache > /dev/null
COLOUR="#FF8000"
fi
}
function toggleAll(){
if [ $APACHE = "up" ]; then
gksudo $LAMPP stop
else
gksudo $LAMPP start
fi
}
case $BLOCK_BUTTON in
1) toggleApache ;;
3) toggleAll ;;
esac
if [ -z "$COLOUR" ]; then
if [ "$APACHE" = "up" ]; then
COLOUR="#00FF00"
else
COLOUR="#FF0000"
fi
fi
echo "Apache"
echo ""
echo "$COLOUR"