在实时同步时
为了防止sersync服务挂掉
可以写一个开启sersync服务的脚本
将脚本写入计划任务中
[root@haha ~]# vim autostart-sersync.sh
#!/bin/bash
sersync="/opt/sersync/sersync2"
confxml="/opt/sersync/confxml.xml"
status=`ps aux | grep 'sersync2' | grep -v 'grep' | wc -l`
if [ $status -eq 0 ];then
$sersync -d -r -o $confxml &
else
exit 0
fi
[root@haha ~]# chmod +x autostart-sersync.sh
[root@haha ~]# crontab -e
*/30 * * * * /usr/bin/sh /root/autostart-sersync.sh