linux-systemd

Hanze | Aug 15, 2022 min read

http://www.linuxe.cn/post-371.html

https://blog.csdn.net/lonnng2004/article/details/88964763

** 配置文件存放于/usr/lib/systemd/system/,设置开机启动后会在/etc/systemd/system目录建立软链接文件**

\\~shell

[root@mongo-mms system]# cat mongod-appdb.service

[Unit]

Description=MongoDB Database Server

Documentation=https://docs.mongodb.org/manual

After=network.target

[Service]

User= mongod

Group=mongod

Environment=“OPTIONS=-f /etc/mongodb-mms/app.conf”

ExecStart=/usr/bin/mongod $OPTIONS

PermissionsStartOnly=true

PIDFile=/data/mms-mongodb/app/run/app.pid

Type=forking

Restart=always

RestartSec=30s

# file size

LimitFSIZE=infinity

# cpu time

LimitCPU=infinity

# virtual memory size

LimitAS=infinity

# open files

LimitNOFILE=64000

# processes/threads

LimitNPROC=64000

# locked memory

LimitMEMLOCK=65536

# total threads (user+kernel)

TasksMax=infinity

TasksAccounting=false

# Recommended limits for for mongod as specified in

# http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings

[Install]

WantedBy=multi-user.target

\\~

comments powered by Disqus