0

I'm probably missing something really silly, but does anyone know why this init script isn't running when Docker starts on Amazon Linux 17.09?

#!/bin/sh

### BEGIN INIT INFO
# Provides:          replicated-docker
# Required-Start:    docker
# Required-Stop:     docker
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: send upstart signal after starting docker
# Description:       docker needs to run before some upstart services can run
### END INIT INFO

_status() {
    printf "replicated-docker: %s, %s, %s\n" \
        "$(initctl status replicated)" \
        "$(initctl status replicated-ui)" \
        "$(initctl status replicated-operator)"
}

case "$1" in
    start|restart|reload)
        initctl emit replicated-docker --no-wait
    ;;

    stop)
    ;;

    status)
        _status
    ;;

    *)
        printf "Usage: /etc/init.d/replicated-docker {start|stop|status|reload|restart}\n"
        exit 1
    ;;
esac

exit 0

The goal here is to trigger an upstart service whenever Docker starts. Essentially, I'd like to do what's described in this post, except without having to edit the docker init.d script. Automated editing of someone else's init.d script seems like a great way to break things, after all.

I've ensured the permissions match everything else in /etc/init.d/, it's been added with chkconfig --add replicated-docker, and shows up in service --status-all.

And of course, it works when I run the script manually or through sudo service replicated-docker start.

laverya
  • 1
  • 3

1 Answers1

0

I guess just adding script into /etc/init.d/ is not enough, it needs to be referenced in relevant /etc/rcx.d/.

Ram
  • 119
  • 1
  • 5