Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running Debian 6 on a server. On this server I want to have an instance of Apache2 and MySQL started when the system boots.

For this purpose I know there are the init.d script and the symbolic links in the rc.d directories.

I can check the configuration using the sysv-rc-confcommand:

┌ SysV Runlevel Config   -: stop service  =/+: start service  h: help  q: quit ─┐
│                                                                               │
│ service      1       2       3       4       5       0       6       S        │
│ ----------------------------------------------------------------------------  │
│ apache2     [ ]     [X]     [X]     [X]     [X]     [ ]     [ ]     [ ]       │
│ mysql       [ ]     [X]     [X]     [X]     [X]     [ ]     [ ]     [ ]       │
│                                                                               │
└───────────────────────────────────────────────────────────────────────────────┘

So I try to reboot the machine with the reboot command. And then I test my services:

root@server:~# /etc/init.d/apache2 status
Apache2 is NOT running.
root@server:~# /etc/init.d/mysql status
MySQL is stopped..

I wanted to check the symbolic links but they look ok:

root@server:~# ls -l /etc/rc2.d/
(...)
lrwxrwxrwx 1 root root  15 Mar 12 22:12 S02mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root  13 Sep 22  2011 S02ssh -> ../init.d/ssh
lrwxrwxrwx 1 root root  17 Mar 12 22:12 S03apache2 -> ../init.d/apache2
lrwxrwxrwx 1 root root  18 Jan 24  2012 S03rc.local -> ../init.d/rc.local
(...)

Do you have any idea why this is not working?

share|improve this question
    
have you try to start the service manually ? /etc/init.d/apache2 start or /etc/init.d/mysql start, is it working ? –  chocripple Mar 13 '13 at 11:40
    
post please the output from /var/log/messages or /var/log/syslog there should be some informations on that. otherwise try to start mysqld_safe by hand. –  chifiebre Mar 13 '13 at 12:11

2 Answers 2

up vote 1 down vote accepted

Maybe you should try and use chkconfig package

apt-get install chkconfig

once done, 

chkconfig mysql on 
chkconfig apache2 on 

if for some reason doesn't work you can add

echo "/etc/init.d/mysql start" >> /etc/rc.local
echo "/etc/init.d/apache2 start"  >> /etc/rc.local

restart and test

share|improve this answer
    
It works with the chkconfig command, thank you. What is the difference between chkconfig and update-rc.d ? –  Leward Mar 13 '13 at 15:53
    
chkconfig & update-rc.d both used to updates and queries runlevel information for system services, I find chkconfig easier to use. –  user1007727 Mar 13 '13 at 16:05
    
+1 I like the answer, short and to the point :-) –  aseq Mar 15 '13 at 0:56
  • Check if you can start Apache2 and MySQL manually using the startup scripts inside the /etc/init.d directory
  • Check the log files, especially /var/log/syslog, /var/log/messages, /var/log/apache/ and /var/log/mysql/
  • Check your runlevel using the runlevel command and make sure that the symlinks reside inside the proper /etc/rc[runlevel].d directory
  • Try to re-enable the symlinks inside the /etc/rc[runlevel].d directoried using the update-rc.d command
share|improve this answer
    
I didn't not find something revelant in the logs. The solution that user1007727 gave works. Thank you for your help. –  Leward Mar 13 '13 at 15:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.