Loading...
# rsync 开机自动启动
## 将启动写入 rc.local
```
echo "/usr/bin/rsync --daemon" >> /etc/rc.local
```
运行如下
```
root@dwtowen: /etc/rsync/bin
# echo "/usr/bin/rsync --daemon" >> /etc/rc.local
```
## 守护进程
```
grep daemon /etc/rc.local
```
运行如下
```
root@dwtowen: /etc/rsync/bin
# grep daemon /etc/rc.local [11:13:30]
/usr/bin/rsync --daemon
```
## 启动rsync
```
/usr/bin/rsync --daemon
```
运行如果提示如下
```
root@dwtowen: /etc/rsync/bin
# /usr/bin/rsync --daemon [11:13:52]
failed to lock pid file /var/run/rsync.pid: Resource temporarily unavailable
```
这是因为 rsync 已经在运行造成的。关闭再次运行即可。
关闭 rsync
```
pkill rsync
```
运行如下
```
root@dwtowen: /etc/rsync/bin
# pkill rsync
```
再次执行 `/usr/bin/rsync --daemon`
```
/usr/bin/rsync --daemon
```
运行如下
```
root@dwtowen: /etc/rsync/bin
# /usr/bin/rsync --daemon
```
这样就可以啦。
重启服务器,查看端口运行;
```
netstat -ntlp
```
```
tcp6 0 0 :::xxxxx :::* LISTEN 23800/rsync
```
rsync 已经开机自动运行啦。
## 重启rsync
重启 rsync ,由于 rsync的重启需要先杀死守护进程,所以先杀死守护进程,再执行重启即可。
如下:
```
pkill rsync
```
```
rsync --daemon
```
这样就可重启啦。
End Thanks!!😁
最后修改:2021 年 02 月 23 日 11 : 32 AM
© 允许规范转载
赞赏
如果觉得我的文章对你有用,请随意赞赏
×Close
赞赏作者
扫一扫支付
支付宝支付
微信支付