We have several daemons that we are starting up via a snap. All of the daemons are looking for specific directory's for their data. One of the apps is mongo. Unfortunately the data directory is empty so the db folder does not exist.

    command: app1 --path "$SNAP_DATA/app1
    daemon: simple

    command: mongod --dbpath "$SNAP_DATA/db/"
    daemon: simple
    plugs: [network-bind]

how can we force that directory to be created before the mongodb daemon starts?


The correct way to handle this is for the command to run a script instead of mongod directly. The script should format the directory and then exec mongo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.