github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/acceptancetests/repository/charms/simple-resource-http/hooks/config-changed (about) 1 #!/bin/sh 2 3 status-set maintenance "Started" || true 4 HTTP_SERVER_SCRIPT="${JUJU_CHARM_DIR}/scripts/simple-server.py" 5 6 RES_NAME="index" 7 RES_PATH=$(resource-get $RES_NAME) 8 DEFAULT_FILE="${JUJU_CHARM_DIR}/files/default-file.txt" 9 10 INDEX_FILE=${RES_PATH:-${DEFAULT_FILE}} 11 12 juju-log -l INFO "Stopping any existing simple servers." 13 # using 'grep hack' to not catch grep process in the list. 14 kill $(ps aux | grep [s]imple-server.py | awk '{print $2}') || true 15 16 juju-log -l INFO "Serving file: ${INDEX_FILE}" 17 18 nohup $HTTP_SERVER_SCRIPT --file-path "${INDEX_FILE}" --port 80 >> /tmp/server-output.log 2>&1 & 19 open-port 80 20 21 status-set active "Started" || true