#!/bin/sh

set -e
set -o xtrace

cat > /lib/systemd/system/mongos.service << '_EOF_'
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
Documentation=https://docs.mongodb.org/manual

[Service]
User=mongodb
Group=mongodb
RuntimeDirectory=mongodb
ExecStart=/usr/bin/mongos --quiet --config /etc/mongos.conf
LimitFSIZE=infinity
LimitCPU=infinity
LimitAS=infinity
LimitNOFILE=64000
LimitRSS=infinity
LimitNPROC=64000

[Install]
WantedBy=multi-user.target
_EOF_

systemctl daemon-reload
systemctl enable mongos.service
