diff --git a/snap/local/start-mongod.sh b/snap/local/start-mongod.sh index 278dbb3..4a4f2ac 100755 --- a/snap/local/start-mongod.sh +++ b/snap/local/start-mongod.sh @@ -8,7 +8,11 @@ ulimit -Sl unlimited ulimit -SHn 64000 ulimit -SHu 64000 -MONGOD_ARGS="$(snapctl get mongod-args)" +SNAP_ARGS="$(snapctl get mongod-args)" + +if [ $? -eq 0 ]; then + MONGOD_ARGS=$SNAP_ARGS +fi # For security measures, daemons should not be run as sudo. Execute mongod as the non-sudo user: snap-daemon. exec $SNAP/usr/bin/setpriv --clear-groups --reuid snap_daemon \ --regid snap_daemon -- $SNAP/usr/bin/mongod --config ${SNAP_DATA}/etc/mongod/mongod.conf ${MONGOD_ARGS} "$@" diff --git a/snap/local/start-mongos.sh b/snap/local/start-mongos.sh index e3eae00..075abfc 100755 --- a/snap/local/start-mongos.sh +++ b/snap/local/start-mongos.sh @@ -8,7 +8,12 @@ ulimit -Sl unlimited ulimit -SHn 64000 ulimit -SHu 64000 -MONGOS_ARGS="$(snapctl get mongos-args)" +SNAP_ARGS="$(snapctl get mongos-args)" + +if [ $? -eq 0 ]; then + MONGOS_ARGS=$SNAP_ARGS +fi + # For security measures, daemons should not be run as sudo. Execute mongos as the non-sudo user: snap-daemon. exec $SNAP/usr/bin/setpriv --clear-groups --reuid snap_daemon \ --regid snap_daemon -- $SNAP/usr/bin/mongos ${MONGOS_ARGS} "$@"