I am trying to write a script that will enable xampp start
and xampp stop
with the same script without having to write in the terminal everytime.
To start xampp
, I write in console :
sudo /opt/lampp/lampp start
sudo /opt/lampp/lampp stop
How to make a script executable which allows xampp
to start and stop simultaneously when double clicked ? Any idea is always welcomed.
You'll need to do 2 things to get what you want :
1) Create a simple bash script to start
lampp
I've written it for you! It starts
lampp
if it isn't started and stops it if it's already started :2) Create a shortcut that will launch that script (on the Desktop for example) :
A) Create a
.desktop
file on the Desktop :B) Enter the following in it :
=> Remplace the two /PATH/TO/THE/... by something. Icons are stored in
/usr/share/icons/
and a good place for the script would be in your HOME folder, maybe hidden (hide by adding a.
at the beginning of his name).C) Make it executable :
Note : the script isn't really checking if
lampp
is working, it is using a temporary file (disapears at reboot) containing 1 if you have used the script once (meaning it's started) and 0 if you haven't used the script (meaning it isn't started). What does it mean ? That you have to only use this script if you want things to work : do not startlampp
without this script and you'll be ok.Note : you'll have to type your password in order to launch the shortcut. You could bypass that, but that wasn't your question so I will not explain that here.
You can use a script like this,
Save the script. Give it execution permission,
It should give you
Run
option on double-clicking on it. If you wish you can make a.desktop
file to run it.Note: See this answer to run
sudo /opt/lampp/lampp
without password.