Skip to content

Instantly share code, notes, and snippets.

@diniremix
Last active April 26, 2021 20:24
Show Gist options
  • Save diniremix/9032c7852dde36806640 to your computer and use it in GitHub Desktop.
Save diniremix/9032c7852dde36806640 to your computer and use it in GitHub Desktop.
simple script to run xampp service (linux)
#!/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
@diniremix
Copy link
Author

now using notify-send and sudo ! :)

@Xozenn
Copy link

Xozenn commented Apr 26, 2021

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