以redis为例
vi /lib/systemd/system/redis.service
写入以下信息后保存即可
[Unit]
Description=Redis
After=network.target[Service]
#Type=forking
ExecStart=/usr/local/redis/redis-6.2.14/src/redis-server /usr/local/redis/redis-6.2.14/redis.conf
ExecReload=/usr/local/redis/redis-6.2.14/src/redis-server -s reload
ExecStop=/usr/local/redis/redis-6.2.14/src/redis-server -s stop
PrivateTmp=true[Install]
WantedBy=multi-user.target
将启动进程加入Systemctl服务
于 2023-11-11 17:30:21 首次发布