#!/bin/bash # Usage: ./startup.sh # Debug: DBG=1 ./startup.sh # See also cleanup.sh >&2 echo "Running script: $0" # Error function # usage: err $msg err(){ echo "\e[31m\n[Error $1]" echo "\e[0m" exit 1 } # Turn on debug in containers (restconf, backend) DBG=${DBG:-0} # Expose other host port than port 80 PORT=${PORT:-80} # Initial running datastore content (other than empty) STORE=${STORE:-} CONFIG0=$(cat < /usr/local/etc/example.xml *:* /usr/local/share/clixon clixon-example example /usr/local/lib/example/backend /usr/local/lib/example/netconf /usr/local/lib/example/restconf /usr/local/lib/example/cli /usr/local/lib/example/clispec /usr/local/var/example/example.sock /usr/local/var/example/example.pidfile 1 VARS /usr/local/var/example 0 init disabled EOF ) CONFIG=${CONFIG:-$CONFIG0} # Start clixon-example backend >&2 echo -n "Starting Backend..." sudo docker run -p $PORT:80 --name clixon-system --rm -e DBG=$DBG -e CONFIG="$CONFIG" -e STORE="$STORE" -td clixon/clixon-system || err "Error starting clixon-system" >&2 echo "clixon-system started"