I noticed that lampp starts proftpd
so we can modify a scirpt that checks for a running service, if that service is running then it will stop lampp, I modified the script from here - http://www.anyexample.com/linux_bsd/bash/check_if_program_is_running_with_bash_shell_script.xml
So first make an empty text file, or open gedit, and paste this code-
#!/bin/sh
SERVICE='proftpd'
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
gksudo /opt/lampp/lampp stop && notify-send -i /opt/lampp/htdocs/xampp/img/logo-small.gif "XAMPP stopped."
else
gksudo /opt/lampp/lampp start && notify-send -i /opt/lampp/htdocs/xampp/img/logo-small.gif "XAMPP started."
fi
This should also send notification that it starts and stops.
Save the file as lampp.sh
and make it executable - right click => Properties => Permissions => Allow executing file as program.
Now use your favorite method to make a launcher with the script, How can I create launchers on my desktop?
Or I made one that includes the icon-
Place lampp.sh
in /usr/local/bin
Create a file named Lampp.desktop
and paste this into it-
[Desktop Entry]
Version=1.0
Type=Application
Name=Lampp
Comment=
Exec=/usr/local/bin/lampp.sh
Icon=/opt/lampp/htdocs/xampp/img/logo-small.gif
Path=
Terminal=false
StartupNotify=true
GenericName=
Or if you want you can make a right click list for the different functions to achieve start and stop function without the script-
[Desktop Entry]
Version=1.0
Type=Application
Name=Lampp
Comment=
Exec=gksudo lampp
Icon=/opt/lampp/htdocs/xampp/img/logo-small.gif
Path=/opt/lampp
Terminal=false
StartupNotify=true
GenericName=
X-Ayatana-Desktop-Shortcuts=NewWindow;Start;Stop;Restart;Security
[Start Shortcut Group]
Name=Start
Exec=start
TargetEnvironment=Unity
[Stop Shortcut Group]
Name=Stop
Exec=stop
TargetEnvironment=Unity
[Restart Shortcut Group]
Name=Restart
Exec=restart
TargetEnvironment=Unity
[Security Shortcut Group]
Name=Security
Exec=security
TargetEnvironment=Unity
So use one or the other, have fun.
Also I found they wrote a control panel for the program to use-
gksudo /opt/lampp/share/xampp-control-panel/xampp-control-panel.py
I you want to try this with other programs you can make scripts that will check if the are running and will kill them (warning might loose work, but would be nice for frozen programs) Say for example conky
or any other program, mostly.
#!/bin/sh
SERVICE='conky'
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
killall conky
else
conky
fi
save as conky.sh put in /usr/local/bin
Next is the hard part, you need to find the conky.desktop file, so in terminal type locate conky.desktop
then navigate to that folder and edit the desktop file in gedit (or your favorite editor, may need privileges depending on where it is) and replace the Exec=
line with Exec=/usr/local/bin/conky.sh
(note that this will break any of the launchers that have right click menus)