I am creating a startup script for my Ubuntu 14.04.1 LTS server. The script need to be run after the Rabbit MQ server. The Rabbit MQ startup script says it provides "rabbitmq-server". So I put this string in the "Required-Start" list of my startup script headers (see below). However, after installing my script with update-rc, both the Rabbit MQ script and my script are at the "S20" level, i.e. I don't think the dependency has worked. My script is also not starting correctly, but does start if I run it manually after bootup. Any ideas as to what could be wrong?

    # Provides: amqp_receive
    # Required-Start: $local_fs $network rabbitmq-server
    # Required-Stop:
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Script to provide start/stop/status of the amqp_receive program

    lrwxrwxrwx 1 root root  22 Aug 17 00:29 S20amqp-receive -> ../init.d/amqp-receive
    lrwxrwxrwx 1 root root  25 Aug 13 18:14 S20rabbitmq-server -> ../init.d/rabbitmq-server
    lrwxrwxrwx 1 root root  15 Apr 16 18:26 S20rsync -> ../init.d/rsync
    lrwxrwxrwx 1 root root  24 Apr 16 18:26 S20screen-cleanup -> ../init.d/screen-cleanup
    lrwxrwxrwx 1 root root  23 Apr 16 18:26 S38open-vm-tools -> ../init.d/open-vm-tools
    lrwxrwxrwx 1 root root  26 Apr 16 18:26 S45landscape-client -> ../init.d/landscape-client
    lrwxrwxrwx 1 root root  19 Apr 16 18:26 S70dns-clean -> ../init.d/dns-clean
    lrwxrwxrwx 1 root root  18 Apr 16 18:26 S70pppd-dns -> ../init.d/pppd-dns
    lrwxrwxrwx 1 root root  21 Apr 16 18:26 S99grub-common -> ../init.d/grub-common
    lrwxrwxrwx 1 root root  18 Apr 16 18:25 S99ondemand -> ../init.d/ondemand
    lrwxrwxrwx 1 root root  18 Apr 16 18:25 S99rc.local -> ../init.d/rc.local


The problem is that the scripts run in alphabetical order (as you stated above, the problem is that they both start with S20) - so S20amqp-receive runs before S20rabbitmq-server. I'm with you, something has gone wrong while executing update-rc.d. Maybe just execute update-rc.d amqp-receive defaults again.

Another solution could be to just (manually) rename S20amqp-receive to S21amqp-receive. Then this script will be executed after the ones starting with S20.

Note: It would be nicer to try to fix the dependencies.

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.