Sha256: 35fd2d437204ca21aa342f1a3fb7d7196ff134d69f8b2d583bcb919a47628de2

Contents?: true

Size: 1.99 KB

Versions: 3

Compression:

Stored size: 1.99 KB

Contents

#! /bin/sh

### BEGIN INIT INFO
# Provides:          md_tcp_server
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts the MelissaData TCP server
# Description:       Starts the MelissaData TCP server
### END INIT INFO

NAME=md_tcp_server
SCRIPTNAME=/etc/init.d/$NAME
DAEMON=<%= node[:melissadata][:paths][:bin_dir] %>/$NAME
PID_FILE=/var/run/$NAME.pid
RUNASUSER=<%= node[:melissadata][:runner_user] %>
ARGS=""

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

# Function that starts the daemon/service
do_start() {
  start-stop-daemon \
    --start --background \
    --make-pidfile --pidfile $PID_FILE \
    --chuid $RUNASUSER \
    --exec $DAEMON -- $ARGS || true
}

# Function that stops the daemon/service
do_stop() {
  start-stop-daemon --stop --pidfile $PID_FILE
}

case "$1" in
  start)
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $NAME"
        do_start
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  stop)
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $NAME"
        do_stop
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;

  restart)
        do_stop
        case "$?" in
          0|1)
                do_start
                case "$?" in
                        0) log_end_msg 0 ;;
                        1) log_end_msg 1 ;; # Old process is still running
                        *) log_end_msg 1 ;; # Failed to start
                esac
                ;;

          *)
                # Failed to stop
                log_end_msg 1
                ;;
        esac
        ;;

  *)
        log_action_msg "Usage: $SCRIPTNAME {start|stop|restart}" >&2
        exit 3
        ;;
esac

exit 0

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
melissadata-0.1.5 chef/cookbooks/melissadata/templates/default/md_tcp_server.init.erb
melissadata-0.1.4 chef/cookbooks/melissadata/templates/default/md_tcp_server.init.erb
melissadata-0.1.3 chef/cookbooks/melissadata/templates/default/md_tcp_server.init.erb