Hi everyone!
We use some wrapper for run csync2 on each of nodes:
#!/bin/bashlist="node01 node02 node03"trid=$(date +%s)LOGS_PATH=/var/log/csync2_mastermkdir -p $LOGS_PATHCUR_DATE=`date +%F`find $LOGS_PATH -type f -mtime +30 -exec rm -f {} \; 2>&1 | tee $LOGS_PATH/last.log | tee -a $LOGS_PATH/$CUR_DATE.logfor ip in $list;doecho ' ******' 2>&1 | tee -a $LOGS_PATH/last.log | tee -a $LOGS_PATH/$CUR_DATE.logecho 'Starting '${trid}' sync on '$ip' at '`date` 2>&1 | tee -a $LOGS_PATH/last.log | tee -a $LOGS_PATH/$CUR_DATE.logssh csync2@$ip "timeout 3600 sudo csync2 -Bvx" 2>&1 | tee -a $LOGS_PATH/last.log | tee -a $LOGS_PATH/$CUR_DATE.logecho 'Finishing '${trid}' sync on '$ip' at '`date` 2>&1 | tee -a $LOGS_PATH/last.log | tee -a $LOGS_PATH/$CUR_DATE.logecho ' ====== ' 2>&1 | tee -a $LOGS_PATH/last.log | tee -a $LOGS_PATH/$CUR_DATE.logdoneecho -e "*=*=*=*=*=*=\n" 2>&1 | tee -a $LOGS_PATH/last.log | tee -a $LOGS_PATH/$CUR_DATE.logsleep 60;
You must place this script to some *nix machine
This machine must can connect to all nodes using csync2 account, and account csync2 must have sudo permissions for run csync2 binary (you also can run csync2 from csync2 user, but in this case csync2 may have not permissions for synchronize some files)
timeout 3600 - this is time limit for csync2 process, you can change timeout value for your case
sleep 60 - after all nodes are synchronized, you can sleep 60 seconds before next synchronization
If you need, you can wrap content of this script in a infinite loop (while true;do .... ;sleep 60;done) and run it in screen
Alternatively of infinite loop, you can run this script in supervisord , if you have any questions, you can write email for me :)
--
С уважением,
С уважением,
Гусев Павел
Руководитель отдела системного администрирования
QSOFT | Ведущий web-интегратор
офис 7(495) 771-7363 #110 | моб. 7(926) 850-1108
pgu...@qsoft.ru
Москва, Авангардная улица, 3 | qsoft.ru
San Francisco, 222 Columbus Ave | qsoftus.com
06.01.2015, 10:35, "Weinzierl Stefan" <ste...@weinzierl-stefan.de>:
On 06.01.2015 04:16, Marc Fournier wrote:
Terrible subject, sorry … basically, if I setup cron to run csync2 every 10 minutes, if it takes longer then 10 minutes, is there anything that prevents another instance of csync2 from starting up?Hello,
I use this script:
#!/bin/sh
PIDFILE=/var/run/csync2.sh.pid
if [ -e $PIDFILE ]; then
kill -s 0 `cat $PIDFILE` && exit;
fi
echo $$ > $PIDFILE
/usr/sbin/csync2 -x -B
rm $PIDFILE -rf
Stefan
_______________________________________________
Csync2 mailing list
Csync2@lists.linbit.com
http://lists.linbit.com/mailman/listinfo/csync2
_______________________________________________ Csync2 mailing list Csync2@lists.linbit.com http://lists.linbit.com/mailman/listinfo/csync2