文章目录
service的普遍写法
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=sduer
ExecStart=/usr/local/mongodb-4.4.4/mongod --config /etc/mongod.conf
[Install]
WantedBy=multi-user.target
这样就可以跑了,关闭将就一下,用这个
kill -2 pid
讲究一下,就添加ExecStop=
可以使用上面例子中的./mongod --shutdown --config /etc/mongod.conf
也可以直接kill
查看/启动 服务
systemctl list-unit-files --type=service
systemctl daemon-reload
systemctl enable mongodb
systemctl start mongodb