I occasionally want a local web server on my netbook for fiddling around, but don’t want it running on start up. So, using the following steps I removed it from the start up list and created a launcher button to start and stop apache and mysql.
1. Remove from startup list:
$sudo update-rc.d apache remove
$gksu gedit /etc/init/mysql.conf
In your text editor look for the lines with start up information and comment them out by adding a hash at the beginning of each line.
2. Write simple start script
$gksu gedit /usr/local/bin/lampstart
In your text editor paste the following code:
#/bin/bash
sudo /usr/sbin/apache2ctl start
sudo service mysql start
Save and exit
3. Write simple stop script
$gksu gedit /usr/local/bin/lampstop
In your text editor paste the following code:
#/bin/bash
sudo /usr/sbin/apache2ctl stop
sudo service mysql stop
Save and exit
4. Make scripts executable and update db
$sudo chmod +x /usr/local/bin/lampstart
$sudo chmod +x /usr/local/bin/lasr/mpstop
$sudo updatedb
5. Make launcher icons
Go to System->Preferences->Main Menu
In the left pane select the application group for the icons
Click ‘New Item’
Enter the following details:
Type: Application in Terminal
Name: Start LAMP
Command: /usr/local/bin/lampstart
Comment: Starts Apache and mysql
Optionally click the icon in the top left and look for a nice pic, I found suitable ones in /usr/share/icons/hicolor/48×48/apps