#!/usr/bin/env bash source $SNAP/helper/functions require_root plugs_connected if [ $? -ne 0 ]; then echo "Failed to enable ${SNAP_NAME} service!" >&2 echo "" echo "Consult the help command:" >&2 echo "${SNAP_NAME}.help" >&2 echo "" echo "Ensure ${SNAP_NAME} is booting successfully before daemonize it" >&2 echo "by running the app manually (${SNAP_NAME}.exec)." >&2 exit 1 fi snapctl start --enable "${SNAP_NAME}.${SNAP_NAME}" if [ $? -eq 0 ]; then echo "Service enabled!" echo "- If you have turned OFF «log to file», follow logs with:" echo " $ snap logs ${SNAP_NAME} -f" echo "- If you have turned ON «log to file», follow logs with:" echo " $ tail -f ${SNAP_DATA}/*.log" exit 0 fi echo "Failed enabling service" >&2 exit 1