Sha256: c1f5a7d53d4ba9cff47df8de32099e48dd6bc35f8469ed7f64bf8b7fde0ad985

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

#!/bin/sh
# init script for the CanControlsGateway. Goes into /etc/init.d/

name="can_controls_gateway"
executable="/home/webs/CanControlsGateway/current/bin/can_controls_gateway"
rubypath="/usr/bin/env ruby"
pidfile="/var/run/$name.pid"
user=webs

stop_can_controls_gateway() {
    echo "stopping $name ..."
    start-stop-daemon --stop --pidfile $pidfile -v
    rm -f $pidfile
}

start_can_controls_gateway() {
    echo "starting $name ..."
    start-stop-daemon -c $user --start --background --make-pidfile -v --pidfile $pidfile --exec $executable
}

running() {
    if [ -f $pidfile ]
    then
        return 0
    else
        return 1
    fi
}

if [ ! -x $executable ]
then
    echo "Cannot find $name executable. Aborting."
    exit 0
fi

case "$1" in
    start)
        if running
        then
            echo "$name already running or stale pidfile. Aborting."
            exit 0
        fi
        start_can_controls_gateway
        ;;
    stop)
        stop_can_controls_gateway
        ;;
    restart)
        stop_can_controls_gateway
        start_can_controls_gateway
        ;;
    *)
        echo "Usage: $0 {start|stop|restart}" >&2
        exit 3
        ;;
esac

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tg-can-controls-gateway-0.1.3 etc/init-script_debian
tg-can-controls-gateway-0.1.2 etc/init-script_debian
tg-can-controls-gateway-0.1.1 etc/init-script_debian
tg-can-controls-gateway-0.1.0 etc/init-script_debian