D
D
Dmitry2014-12-09 23:58:16
linux
Dmitry, 2014-12-09 23:58:16

How to make shortcuts to start and stop XAMPP on Ubuntu desktop?

For convenience, you need to make shortcuts to start / restart / stop XAMPP on the desktop .

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nazar Mokrinsky, 2014-12-10
@1diem

Let's say you want to run Apache2, for this you need:
So, as you will not run from the terminal - then:
Now get a graphical window for entering a password.
If you also want to run mysql/mariadb - create a simple bash script, put commands there, execute it via pkexec.
It is most convenient to create your own service - by analogy with the rest in /etc/init.d, put it next to it, you can call it through service by name.
The shortcut can be created manually by duplicating and editing any file from ~/.local/share/applications(there is likely to be at least one there), or graphically through the alacarte application (install if not worth it), and transferring it to the desktop.
As a result, you can create your own service, and run it through a shortcut using pkexec.
At the end - my service for an example (the /etc/init.d/webserver file, you need to remember to make it executable):

#!/bin/sh

start()
{
  service apache2 start
  service mysql start
  service memcached start
  service php5-fpm start
  service hhvm start
  service nginx start
}
stop()
{
  service apache2 stop
  service mysql stop
  service memcached stop
  service php5-fpm stop
  service hhvm stop
  service nginx stop
}
restart()
{
  service apache2 restart
  service mysql restart
  service memcached restart
  service php5-fpm restart
  service hhvm restart
  service nginx restart
}

case "$1" in
start)	echo -n " * Starting WebServer...\n"
  start
    echo " * OK!\n" 
  ;;
stop)	echo -n " * Stopping WevServer...\n"
  stop
    echo " * OK!\n"
    ;;
restart) echo -n " * Restarting WebServer...\n"
  restart
    echo " * OK!\n"
    ;;
esac
exit 0

In the shortcut, the command pkexec service webserver startis , well, stop / restart by analogy.
Also read about folders /etc/initand /etc/rc*.dif you want everything not to start at system startup, but only on demand.

E
Ergil Osin, 2014-12-10
@Ernillew

1. Allow your user passwordless sudo to restart the necessary services
2. Make scripts that will restart
3. Put symlinks on these scripts / scripts themselves / desktop files to run scripts on the desktop
4. Do not listen to the three previous tips, restart from the command line lines.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question