Question - how to auto-start and stop LAMPP

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Question - how to auto-start and stop LAMPP

Postby bl4d3 x » 25. October 2011 19:21

I want xampp to start and stop when the server is rebooted but the info below is not all that clear to a linux nub

where do i type this part Simply type egrep :initdefault: /etc/inittab. i did it in the linux terminal but got no answer from it

After I rebooted my Linux box XAMPP stopped running! How can I fix this?

Correct. That's normal Linux behaviour (which applies to any other Unix-like system. It's the admin's job to make sure a particular application is started at bootup.
There is no real standard way to configure the boot process of a Linux system, but most of them should allow you to start XAMPP at boot time using the following steps.

First, find out your default runlevel.
Simply type egrep :initdefault: /etc/inittab.
You should now see a line containing a number between two colons.
In most cases 3 or 5 (2 if you're using Debian).
Go into the directory which configures this runlevel. If for example your runlevel is 3, then you have to change into the /etc/rc.d/rc3.d directory:
cd /etc/rc.d/rc3.d

If your system didn't provide /etc/rc.d/rc3.d please try also /etc/init.d/rc3.d and /etc/rc3.d.

Now carry out the actual configuration by typing:
ln -s /opt/lampp/lampp S99lampp
ln -s /opt/lampp/lampp K01lampp

Now XAMPP should start and stop automatically if you boot or shutdown your machine.
ubuntu 11.10 xampp 1.7.7
bl4d3 x
 
Posts: 21
Joined: 22. October 2011 18:18
Operating System: linux (Ubuntu 11.10)

Re: start and stop

Postby JonB » 25. October 2011 21:13

Which Linux distribution are you using and which version :shock:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: start and stop

Postby bl4d3 x » 25. October 2011 23:30

Ubuntu 11.10
ubuntu 11.10 xampp 1.7.7
bl4d3 x
 
Posts: 21
Joined: 22. October 2011 18:18
Operating System: linux (Ubuntu 11.10)

Re: start and stop

Postby JonB » 26. October 2011 00:05

OK

Listen, when it comes to Linux, they are ALL different (way worse than Windows) - the thing they have in common is the Linux kernel. So when you ask a Linux question, always say the 'Distro' and version.

And it would make life easier here if you put that in your Apache Friends Forum profile.

Thanks, and I'll check on this for ya. Because all the distro's are different, things are in different places, AND some things just don't work on a different system.

8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: start and stop

Postby bl4d3 x » 26. October 2011 00:28

Right you are then profile updated does that help now lol and ty for taking the time to help a linux nub.
ubuntu 11.10 xampp 1.7.7
bl4d3 x
 
Posts: 21
Joined: 22. October 2011 18:18
Operating System: linux (Ubuntu 11.10)

Re: start and stop

Postby JonB » 26. October 2011 13:13

I'll test the command on my LAMPP box @ work today :)

8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: start and stop

Postby JonB » 26. October 2011 15:50

The answer is this (for now)

egrep :initdefault: /etc/inittab


is not going to fly

Reason:
the /etc/inittab method was deprecated (meaning 'obsoleted') in the distribution you are using. You can read that as "the information you were using is out of date" (inittab stands for initialize tables -- what and how to start at boot)

egrep is a command to search for a string in a file, since there wasn't 'any of that' (because there is no longer an 'inittab'), egrep returned a "null" ('blank' -nothing to report)

http://blog.mypapit.net/2007/03/where-c ... -fawn.html

Google "inittab deprecated"

So that method of auto-starting XAMPP is not going to fly. I'm going to do some research later this week, or on the weekend. I'll keep you all posted.

8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: start and stop

Postby JonB » 26. October 2011 16:33

I'm going to post 'auto-start' answer now -

How to auto-start LAMPP on Linux distributions using the /etc/rc.d/rc.local file.

Using a root login, su or sudo, start a term session

Now, use your favorite text editor (mine is geany), but vi, gedit, or nano will also be cool, and edit '/etc/rc.d/rc.local'.
Code: Select all
[root@localhost jonb]# geany /etc/rc.d/rc.local

add the LAMPP start command (/opt/lampp/lampp start) to the end of the file:

Code: Select all
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
# 'touch/var/lock/subsys/local' was already part of my configuration and should NOT be added to yours

touch /var/lock/subsys/local
/opt/lampp/lampp start


Save the file - restart your box.
login

use term and check your LAMPP
Code: Select all
[jonb@localhost ~]$ su
Password:
[root@localhost jonb]# /opt/lampp/lampp status
Version: XAMPP for Linux 1.7.4
Apache is running.
MySQL is running.
ProFTPD is running.


~ tada ~ It werky!

This works because you edited the file as 'root', and the rc.d/rc.local is run AFTER all other initialization has been done (the system is 'ready'), and BEFORE the login prompt is offered. (remembering that ONLY 'root' can start Apache). rc.d == 'run command.daemon' (it allows you to run commands)

https://www.linux.com/news/enterprise/s ... cd-scripts

I'll work out the shutdown in another episode, stay tuned :lol:

8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Question - how to auto-start and stop LAMPP

Postby bl4d3 x » 27. October 2011 03:37

Ty i have not tried it just yet as its 3;36 in the morning but il be sure to let you know how i get on with it.
ubuntu 11.10 xampp 1.7.7
bl4d3 x
 
Posts: 21
Joined: 22. October 2011 18:18
Operating System: linux (Ubuntu 11.10)


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 7 guests