Last active
April 26, 2021 20:24
-
-
Save diniremix/9032c7852dde36806640 to your computer and use it in GitHub Desktop.
simple script to run xampp service (linux)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PASSWD= | |
XAMPP_PATH=/opt/lampp/lampp | |
run_as_root (){ | |
PASSWD=`zenity --password --title "Xampp requires access"` | |
} | |
run_xampp_service (){ | |
resp=$(zenity --list --text "Xampp" --radiolist --column "Option" --column "Action" TRUE "Iniciar servicio" FALSE "Detener servicio" FALSE "Reiniciar servicio"); | |
} | |
notify_service (){ | |
sleep 1 | |
notify-send -u normal "Xampp" "$1" | |
} | |
run_as_root; | |
if [ ! $PASSWD ]; then | |
zenity --error --title="An Error Occurred" --text="You need to be root to perform this action." | |
exit 1; | |
else | |
run_xampp_service; | |
case $resp in | |
"Iniciar servicio") | |
echo $PASSWD | sudo -S $XAMPP_PATH start && notify_service "Started XAMPP for Linux" | |
;; | |
"Detener servicio") | |
echo $PASSWD | sudo -S $XAMPP_PATH stop && notify_service "Stopped XAMPP for Linux" | |
;; | |
"Reiniciar servicio") | |
echo $PASSWD | sudo -S $XAMPP_PATH restart && notify_service "Restarted XAMPP for Linux" | |
;; | |
esac | |
PASSWD= | |
fi |
IT HELPED ME A LOT! THANKS!!!
I always do in terminal:
$ cd opt/lampp
$ sudo ./manager-linux-x64.run
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
now using notify-send and sudo ! :)