# 编写Unit 的配置文件
1、fastdfs-tracker.service
[Unit]
Description=The FastDFS File server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/data/fastdfs/tracker/data/fdfs_trackerd.pid
ExecStart=/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start
ExecStop=/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf stop
[Install]
WantedBy=multi-user.target
2、fastdfs-storage-group1.service
[Unit]
Description=The FastDFS File server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/data/fastdfs/storage/group1/data/fdfs_storaged.pid
ExecStart=/usr/bin/fdfs_storaged /etc/fdfs/storage-group1.conf start
ExecStop=/usr/bin/fdfs_storaged /etc/fdfs/storage-group1.conf stop
ExecRestart=/usr/bin/fdfs_storaged /etc/fdfs/storage-group1.conf restart
[Install]
WantedBy=multi-user.targe
# 说明
将 fastdfs-tracker.service
放到 /lib/systemd/system
,(Ubuntu18.04)
$ systemctl daemon-reload
$ systemctl enable fastdfs-tracker.service
$ systemctl start fastdfs-tracker.service
$ systemctl enable fastdfs-storage-group1.service
$ systemctl start fastdfs-storage-group1.service