I want to start service in the following order

mysql mongodb after reboot

I have changed the services mysql init scripts to

lrwxrwxrwx 1 root root  8 Sep  8 11:05 S30mysql -> ../mysql
lrwxrwxrwx 1 root root 10 Sep  8 11:05 S40mongodb -> ../mongodb

30 < 40 so mysql service starts before mongodb

mysql starts properly after reboot but not mongodb ? this is only the case in

SUSE Linux Enterprise Server 11 (x86_64)

How do I even investigate when the /etc/init.d/mongodb script is called on reboot ?

Any other steps which I am missing ?


Step 0. run "runlevel" to make sure you are in the right rcX.d dir

Step 1. Check mongodb log

Step 2. Check if "/etc/init.d/mongodb start" is working or not

Step 3. Check /var/log/boot.msg to make sure your S40mongodb script is called during boot time


/etc/init.d/rc script is responsible for Sxxservice and Kxxservice, once the service is being started/stopped by rc, it prints logs.

346         blogger "$service start"
347         $link start; status=$?
348         echo -en "$rc_reset"
349         splashprogress "$service start"
351         case "$status" in
352         [1-47])  failed="${failed:+$failed }$service"   ;;
353         [56])   skipped="${skipped:+$skipped }$service" ;;
354         0|*)    ;;
355         esac
357         blogger "'$service start' exits with status $status"

One can find the logs in /var/log/boot.msg

<notice -- Aug 23 22:51:48.399483000> puppet start
Starting puppet services.
<notice -- Aug 23 22:51:48.462954000> startproc: execve (/usr/bin/puppet) [ /usr/bin/puppet agent --server=puppet.fleetboard.dmz --logdest=/var/log/puppet/puppet.log ], [ CONSOLE=/dev/console SELINUX_INIT=YES ROOTFS_FSTYPE=ext3 SHELL=/bin/
sh TERM=linux ROOTFS_FSCK=0 crashkernel=1 LC_ALL=POSIX INIT_VERSION=sysvinit-2.86 REDIRECT=/dev/tty1 COLUMNS=80
 PATH=/bin:/sbin:/usr/bin:/usr/sbin DO_CONFIRM= RUNLEVEL=3 PWD=/ SPLASHCFG= PREVLEVEL=N LINES=25 HOME=/ SHLVL=2 splash=silent SPLASH=no ROOTFS_BLKDEV=/dev/vg00/lvroot _=/sbin/startproc DAEMON=/usr/bin/puppet ]
<notice -- Aug 23 22:51:48.980495000> 'puppet start' exits with status 0

If you find out the mongodb script has issues, you can add the following two lines under "#!/bin/bash" in /etc/init.d/mongodb to ease your debugging.

set -x
export PS4='+${BASH_SOURCE}:${LINENO}:${FUNCNAME[0]}: '
  • /etc/init.d/rc comes from SLES 11 SP3, yours maybe different.
    – Enzo Wang
    Sep 8 '15 at 19:28

What you have done should work.
Did you check the system log and/or mongodb logs to see if there is any clue there?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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