1

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?

Leward
  • 113
  • 1
  • 3
  • 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 Answers2

2

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

user1007727
  • 421
  • 5
  • 20
1
  • 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
Guardian
  • 199
  • 4
  • 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