On Fri, May 26, 2017 at 09:30:44AM +0800, Bright Zhao wrote: > Due to some routing rotation purpose, I use crontab to add below info: > > 0 * * * * echo Subnet = 54.169.128.0/17 >> /etc/tinc/myvpn/hosts/aws_sgp > 0 * * * * echo Subnet = 54.169.0.0/17 >> /etc/tinc/myvpn/hosts/aws_sgp > 1 * * * * /usr/sbin/tincd -n myvpn -k > 1 * * * * /usr/sbin/tincd -n myvpn --debug=3 > > 30 * * * * sed -i '/54.169.128.0\/17/d' /etc/tinc/myvpn/hosts/aws_sgp > 30 * * * * sed -i '/54.169.0.0\/17/d' /etc/tinc/myvpn/hosts/aws_sgp > 31 * * * * /usr/sbin/tincd -n myvpn -k > 31 * * * * /usr/sbin/tincd -n myvpn --debug=3
This is not the right way to do it. Cronjobs are being run in parallel.
So if you both stop and start tinc at the same time, there is no
guarantee that it will happen in the right order. The easiest way is to
create two scripts, one that adds the Subnets and the other that removes
them, and the other that adds them.
Another issue is that with tinc 1.0, the -k option sends a TERM signal
to the running tinc daemon, but it might take a little time before it
actually stops. So add a sleep command inbetween, or check for
/var/run/tinc.myvpn.pid to disappear.
--
Met vriendelijke groet / with kind regards,
Guus Sliepen <[email protected]>
signature.asc
Description: Digital signature
_______________________________________________ tinc mailing list [email protected] https://www.tinc-vpn.org/cgi-bin/mailman/listinfo/tinc
