CentOS 7.9 FastDFS 设置开机自启动

发布时间 2023-10-09 10:19:47作者: 龙凌云端

CentOS 7.9 FastDFS 设置开机自启动


 

 

一、前言

关于 FastDFS 服务的启动、停止、重启 相关脚本,可以参考如下博客:

https://www.cnblogs.com/miracle-luna/p/17750542.html

本文主要讲解如何使用 systemctl 系统命令,进行启动、停止、重启、查看 FastDFS 状态等操作。

 

二、实现步骤

1、编写 Nacos 系统启动文件

/lib/systemd/system 目录下创建 fastdfs.service 文件

vi /lib/systemd/system/fastdfs.service

 

编写内容如下:

[Unit]
Description=fastdfs - Fast Distributed File System
After=network.target
 
[Service]
Type=forking
ExecStart=/home/startFastDFS.sh
ExecReload=/home/stopFastDFS.sh
ExecStop=/home/stopFastDFS.sh
PrivateTmp=true
 
[Install]
WantedBy=multi-user.target

说明:其中的 /home/ 目录改为实际的脚本存放目录。

 

2、重载所有服务

systemctl daemon-reload

 

3、设置开机自启动

systemctl enable nacos

 

4、查看开机启动状态