Kaynağa Gözat

build(deb): remove System V init

William Yang 4 yıl önce
ebeveyn
işleme
0c0d55115b

+ 0 - 150
deploy/packages/deb/debian/init.script

@@ -1,150 +0,0 @@
-#! /bin/bash
-### BEGIN INIT INFO
-# Provides:          emqx
-# Required-Start:    $remote_fs $syslog
-# Required-Stop:     $remote_fs $syslog
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Erlang MQTT Broker
-# Description:       EMQX, a distributed, massively scalable, highly extensible MQTT message broker written in Erlang/OT
-### END INIT INFO
-
-NAME=emqx
-DAEMON=/usr/bin/$NAME
-SCRIPTNAME=/etc/init.d/$NAME
-
-# Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-
-# Load the VERBOSE setting and other rcS variables
-. /lib/init/vars.sh
-. /lib/lsb/init-functions
-
-# `service` strips all environmental VARS so
-# if no HOME was set in /etc/default/$NAME then set one here
-# to the data directory for erlexec's sake
-if [ -z "$HOME" ]; then
-    export HOME=/var/lib/emqx
-fi
-
-#
-# Function that starts the daemon/service
-#
-do_start()
-{
-    # Return
-    #   0 if daemon has been started
-    #   1 if daemon was already running
-    #   2 if daemon could not be started
-
-    # Startup with the appropriate user
-    start-stop-daemon --start \
-        --name emqx \
-        --user emqx \
-        --exec $DAEMON -- start \
-        || return 2
-}
-
-#
-# Function that stops the daemon/service
-#
-do_stop()
-{
-    # Identify the erts directory
-    ERTS_PATH=`$DAEMON ertspath`
-
-    # Attempt a clean shutdown.
-    $DAEMON stop
-
-    # waiting stop done sleep 5
-    sleep 5
-    
-    # Return
-    #   0 if daemon has been stopped
-    #   1 if daemon was already stopped
-    #   2 if daemon could not be stopped
-    #   other if a failure occurred
-    # Make sure it's down by using a more direct approach
-    start-stop-daemon --stop \
-                      --quiet \
-                      --retry=TERM/30/KILL/5 \
-                      --user emqx \
-                      --exec $ERTS_PATH/run_erl
-    return $?
-}
-
-#
-# Function that graceful reload the daemon/service
-#
-do_reload() {
-    # Restart the VM without exiting the process
-    $DAEMON restart && return $? || return 2
-}
-
-# Checks the status of a node
-do_status() {
-    $DAEMON ping && echo $"$NAME is running" && return 0
-    echo $"$NAME is stopped" && return 2
-}
-
-case "$1" in
-    start)
-        log_daemon_msg "Starting $NAME"
-        $DAEMON ping >/dev/null 2>&1 && echo $"$NAME is already running" && exit 0
-        do_start
-        case "$?" in
-            0|1) log_end_msg 0 ;;
-            2) log_end_msg 1
-                exit 1
-                ;;
-        esac
-        ;;
-    stop)
-        log_daemon_msg "Stopping $NAME"
-        do_stop
-        case "$?" in
-            0|1) log_end_msg 0 ;;
-            2) log_end_msg 1
-                exit 1
-                ;;
-        esac
-        ;;
-    ping)
-        # See if the VM is alive
-        $DAEMON ping || exit $?
-        ;;
-    reload|force-reload)
-        log_daemon_msg "Reloading $NAME"
-        do_reload
-        ES=$?
-        log_end_msg $ES
-        exit $ES
-        ;;
-    restart)
-        log_daemon_msg "Restarting $NAME"
-        do_stop
-        case "$?" in
-            0|1)
-                do_start
-                case "$?" in
-                    0) log_end_msg 0 ;;
-                    1) log_end_msg 1 && exit 1 ;; # Old process is still running
-                    *) log_end_msg 1 && exit 1 ;; # Failed to start
-                esac
-                ;;
-            *)
-                # Failed to stop
-                log_end_msg 1 && exit 1
-                ;;
-        esac
-        ;;
-    status)
-        do_status && exit 0 || exit $?
-        ;;
-    *)
-        echo "Usage: $SCRIPTNAME {start|stop|ping|restart|force-reload|status}" >&2
-        exit 3
-        ;;
-esac
-
-

+ 0 - 3
deploy/packages/deb/debian/postinst

@@ -5,9 +5,6 @@
 
 set -e
 
-# install startup script
-update-rc.d emqx defaults >/dev/null
-
 # create group
 if ! getent group emqx >/dev/null; then
         addgroup --system emqx

+ 0 - 3
deploy/packages/deb/debian/postrm

@@ -23,9 +23,6 @@ case "$1" in
     purge)
         rm -f /etc/default/emqx
 
-        # ensure we remove the rc.d scripts installed by postinst
-        update-rc.d emqx remove >/dev/null
-
         if [ -d /var/lib/emqx ]; then
                 rm -r /var/lib/emqx
         fi