Simple Daemon Stops Immediately

Hello! I am attempting to snap Zookeeper and have created a yaml file as shown below:

name: zookeeper # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
version: '3.6.3' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
  This is my-snap's description. You have a paragraph or two to tell the
  most important story about your snap. Keep it under 100 words though,
  we live in tweetspace and your description wants to look good in the snap

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

    command: bin/ --config /snap/zookeeper/current/conf
      JAVA_HOME: $SNAP/usr/lib/jvm/java-8-openjdk-amd64/jre
    command: bin/ --config /snap/zookeeper/current/conf start
    plugs: [network, network-bind, removable-media]
    install-mode: enable
    daemon: simple
      JAVA_HOME: $SNAP/usr/lib/jvm/java-8-openjdk-amd64/jre
      ZOO_LOG_DIR: /var/snap/zookeeper/common
      # LOG_DIR: $SNAP_COMMON/log
    # stop-command: bin/ --config /snap/zookeeper/current/conf stop

    plugin: nil
    - openjdk-8-jre-headless
    # build-environment:
    # - JAVA_HOME: /usr/lib/jvm/java-8-openjdk-amd64/
    override-build: |-
      snapcraftctl build
      sed -i "s:dataDir=/tmp/zookeeper:dataDir=/var/snap/zookeeper/common:g" conf/zoo_sample.cfg
      cp conf/zoo_sample.cfg conf/zoo.cfg
      sed -i '158i echo $ZOO_LOG_DIR' bin/
      sed -i "s:#!/usr/bin/env bash:#!/bin/bash -x:g" bin/
    # override-prime: |
    #   snapcraftctl prime
    #   # remove dangling symlink
    #   #
    #   #
    #   rm -vf usr/lib/jvm/java-11-openjdk-*/lib/security/blacklisted.certs

Based on the logs, the service starts successfully, but Is immediately terminated as shown here:

Sep 19 10:46:15 gurren zookeeper.service[2716946]: ++ cat /var/snap/zookeeper/common/
Sep 19 10:46:15 gurren zookeeper.service[2716854]: + pid=2716897
Sep 19 10:46:15 gurren zookeeper.service[2716854]: + ps -p 2716897
Sep 19 10:46:15 gurren zookeeper.service[2716854]: + echo STARTED
Sep 19 10:46:15 gurren zookeeper.service[2716854]: STARTED
Sep 19 10:46:15 gurren systemd[1]: snap.zookeeper.service.service: Deactivated successfully.

Does anyone have any ideas on why the process is terminated? I have checked journalctl, snap logs, and the zookeeper logs and cannot find any errors. Is this a snapcraft issue or could it be an issue with zookeeper?


Can you double check that the daemon is indeed simple and not forking or another type?