Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.
dbourasseau edited this page Feb 1, 2016 · 2 revisions

Base script

#!/bin/sh -e

DAEMON="docker" #where is docker
docker_NAME="nherbaut/adapted-video-osgi-bundle"
daemon_OPT="-e FRONTAL_HOSTNAME=localhost -e FRONTAL_PORT=9090 -p 8080:8080 $docker_NAME"  #arg
daemon_NAME="VHG" 


PATH="/sbin:/bin:/usr/sbin:/usr/bin" 

#test -x $DAEMON || exit 0

. /lib/lsb/init-functions

d_start () {
        log_daemon_msg "Starting system $daemon_NAME Daemon"
	echo "$DAEMON run -d --name $daemon_NAME $daemon_OPT"
	$DAEMON run -d --name $daemon_NAME $daemon_OPT
        log_end_msg $?
}

d_stop () {
        log_daemon_msg "Stopping system $daemon_NAME Daemon"
	echo "$DAEMON stop $daemon_NAME"
        $DAEMON stop $daemon_NAME
	$DAEMON rm $daemon_NAME
	log_end_msg $?
}

case "$1" in

        start|stop)
                d_${1}
                ;;

        restart|reload|force-reload)
                        d_stop
                        d_start
                ;;

        force-stop)
               d_stop
		echo "$DAEMON kill -f $daemon_NAME || true"
                $DAEMON kill -f $daemon_NAME || true
                sleep 2
                #killall -q -9 $daemon_NAME || true
                ;;

        status)
		echo "$DAEMON ps -a"
		$DAEMON ps -a
                status_of_proc "$daemon_NAME" "$DAEMON" "system-wide $daemon_NAME" && exit 0 || exit $?
                ;;

	remove)
		echo "$DAEMON rm $daemon_NAME"
		$DAEMON rm $daemon_NAME
		;;
 
	log)
		echo "$DAEMON logs $daemon_NAME"
		$DAEMON ps --filter=[name=$daemon_NAME]
		;;

	pull|update)
                echo "$DAEMON pull $docker_NAME"
                $DAEMON pull $docker_NAME
                ;;



        *)
                echo "Usage: $0 {start|stop|log|remove|force-stop|restart|reload|force-reload|status|update|pull}"
                exit 1
                ;;
esac
exit 0

start

vhg start

stop

vhg stop
Clone this wiki locally