Fixing snapctl start/stop to control service lifecycle

Adding disable and enable options for snapctl start/stop

Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
This commit is contained in:
Ondrej Kubik 2017-12-06 14:49:18 +00:00
parent fcd7097aba
commit 9c9694bcd1

View file

@ -15,11 +15,10 @@ if [ "$value" = "true" ]; then
port=$(snapctl get port)
[ "x" != "x${bind_port}" ] && sed -i 's|proxy / localhost:.* {|proxy / localhost:'"${bind_port}"' {|g' $SNAP_COMMON/Caddyfile
[ "x" != "x$port" ] && sed -i 's|http://:.*|http://:'"${port}"'|g' $SNAP_COMMON/Caddyfile
snapctl start caddy-service 2>&1 || true
snapctl start --enable ${SNAP_NAME}.caddy 2>&1 || true
else
snapctl stop caddy-service 2>&1 || true
snapctl stop --disable ${SNAP_NAME}.caddy 2>&1 || true
fi
# restart mongo and wekan service
snapctl restart mongodb 2>&1 || true
snapctl restart wekan 2>&1 || true
# restart all services
snapctl restart ${SNAP_NAME} 2>&1 || true