fastdfs自启动
时间: 2023-09-05 09:10:33 浏览: 57
如果你想要在 Linux 系统中使 FastDFS 自启动,可以按照以下步骤进行操作:
1. 创建一个启动脚本(如 `/etc/init.d/fastdfs`)并添加以下内容:
```
#!/bin/sh
#
# fastdfs - startup script for the FastDFS server
#
# chkconfig: 2345 90 10
# description: FastDFS is a high performance distributed file system
#
# Source function library.
. /etc/rc.d/init.d/functions
# Set environment variables
export PATH=$PATH:/usr/local/bin/
# Start FastDFS
start() {
echo -n "Starting FastDFS: "
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf
echo "done."
}
# Stop FastDFS
stop() {
echo -n "Stopping FastDFS: "
/usr/bin/killall fdfs_trackerd
/usr/bin/killall fdfs_storaged
echo "done."
}
# Restart FastDFS
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0
```
2. 修改脚本文件的权限,使其可执行:
```
chmod +x /etc/init.d/fastdfs
```
3. 将脚本添加到系统服务中:
```
chkconfig --add fastdfs
```
4. 启动 FastDFS 服务:
```
service fastdfs start
```
现在,FastDFS 将自动在系统启动时启动。如果需要停止 FastDFS 服务,可以运行以下命令:
```
service fastdfs stop
```
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)