Re: starting apache at boot?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Zach Uram wrote:
I manually compiled apache2 since the version packaged for Debian is
the threaded version which causes fatal memory errors on my VPS host
and it works great but now I need to tell it to start every time my
system boots. Running Debian lenny/sid (testing release) with 2.6.18
Linux kernel. How exactly can I do this?

Hi.
This is not really Apache-specific, and more of an OS question, probably better asked on a Linux Debian forum.

Here is a short tutorial, and for the rest you will have to go to the proper forum :

In the directory /etc/init.d you will find a number of scripts which serve to start daemons at system boot time, and stop them at shutdown time. These scripts are not executed directly, but through links that you will find in /etc/rc2.d (for example). When the system boots, a special boot process makes a sorted list of all the links that it finds in /etc/rc2.d and which start with the letter "S" (S is for "Start"). Then it "calls" each one these links with an argument "start". Because this link points to one of the scripts in /etc/init.d, the corresponding script from /etc/init.d is run, with the "start" argument.
That is what starts a daemon.
Similarly, when the system is shut down, a similar process makes a list of all the links found in /etc/rc2.d and which start with "K" (K like "Kill"). Then it executes each of these links in turn with the argument "stop". The corresponding script in /etc/init.d is then executed with the argument "stop", and that is what stops a running daemon at system shutdown time.

When you install a packaged version of a daemon program like Apache, the package installation procedure takes care of installing the appropriate start/stop script in /etc/init.d, and the corresponding "S" and "K" links in /etc/rc2.d, so it is really easy and most of the time trouble-free.

(That is exactly what makes packages great, and I hereby present my thanks and appreciation to the people who create these packages, since these people are so often villified in forums such as this one.)

If you install a program from source however, you have to take care of this yourself : create the script in /etc/init.d, and the "S" and "K" links in /etc/rc2.d.

There are two ways of doing this :
- either you copy an already existing script (of another installed daemon) in /etc/init.d, and modify it as appropriate for your Apache version; and you create corresponding links in /etc/rc2.d (also look at the ones which already exist, and try to do the same kind of thing)
- or :
- re-install the packaged Apache version which you installed and de-installed earlier. This will install the Apache you do not want, but also, more importantly, the proper startup and shutdown scripts for it. - take a copy of the /etc/init.d/apache2 script, and note the corresponding "Sxxxapache2" and "Kxxxapache2" links that are now in /etc/rc2.d - then de-install (again) that version of Apache (this will delete again the script in /etc/init.d and the links in /etc/rc2.d, which is why you had to make a copy of them in the previous step) - then rename the copies that you made earlier, and modify the /etc/init.d/apache2 script so that it uses you hand-installed version of Apache (points to the correct directory etc..)

A third way would be to ask someone on thist list if they would not have already-made scripts for your version of Apache, and be nice enough to send you a copy and instructions.


André



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux