Revert to using cron for mesh sync

Avoids endless loops
This commit is contained in:
Bob Mottram 2016-08-09 21:38:59 +01:00
parent 32b11987ce
commit 1e67bee0fb
No known key found for this signature in database
GPG Key ID: 0452CC7CEA982E38
2 changed files with 501 additions and 555 deletions

View File

@ -216,12 +216,6 @@ function remove_tox_avahi {
make uninstall
rm -rf $INSTALL_DIR/toxid
sed -i '/tox_avahi/d' $COMPLETION_FILE
if [ -f /etc/systemd/system/mesh-sync.service ]; then
systemctl stop mesh-sync
systemctl disable mesh-sync
rm -f /etc/systemd/system/mesh-sync.service
systemctl daemon-reload
fi
}
function remove_tox_client {
@ -587,33 +581,12 @@ EOF
MESH_SYNC_COMMAND=$rootdir/usr/bin/mesh-sync
echo '#!/bin/bash' > $MESH_SYNC_COMMAND
echo 'while true' >> $MESH_SYNC_COMMAND
echo 'do' >> $MESH_SYNC_COMMAND
echo '/usr/local/bin/toxavahi 2> /dev/null' >> $MESH_SYNC_COMMAND
echo ' sleep 10' >> $MESH_SYNC_COMMAND
echo '/usr/local/bin/zeronetavahi 2> /dev/null' >> $MESH_SYNC_COMMAND
echo ' sleep 10' >> $MESH_SYNC_COMMAND
echo 'done' >> $MESH_SYNC_COMMAND
chmod +x $MESH_SYNC_COMMAND
if [ ! -f $rootdir/etc/systemd/system/mesh-sync.service ]; then
MESH_SYNC_FILENAME=$rootdir/etc/systemd/system/mesh-sync.service
echo '[Unit]' > $MESH_SYNC_FILENAME
echo 'Description=mesh-sync - Service publications over avahi' >> $MESH_SYNC_FILENAME
echo 'After=network.target' >> $MESH_SYNC_FILENAME
echo '' >> $MESH_SYNC_FILENAME
echo '[Service]' >> $MESH_SYNC_FILENAME
echo 'User=root' >> $MESH_SYNC_FILENAME
echo 'ExecStart=/usr/bin/mesh-sync' >> $MESH_SYNC_FILENAME
echo 'Restart=on-failure' >> $MESH_SYNC_FILENAME
echo 'SuccessExitStatus=3 4' >> $MESH_SYNC_FILENAME
echo 'RestartForceExitStatus=3 4' >> $MESH_SYNC_FILENAME
echo '' >> $MESH_SYNC_FILENAME
echo '[Install]' >> $MESH_SYNC_FILENAME
echo 'WantedBy=multi-user.target' >> $MESH_SYNC_FILENAME
chroot "$rootdir" systemctl enable mesh-sync.service
fi
cron_add_mins 1 "$MESH_SYNC_COMMAND"
cron_add_mins 1 "( sleep 30 ; $MESH_SYNC_COMMAND )"
}
function mesh_tox_client {

View File

@ -120,12 +120,6 @@ function remove_zeronet {
if ! grep -Fxq "install_zeronet" $COMPLETION_FILE; then
return
fi
if [ -f /etc/systemd/system/mesh-sync.service ]; then
systemctl stop mesh-sync
systemctl disable mesh-sync
rm -f /etc/systemd/system/mesh-sync.service
systemctl daemon-reload
fi
iptables -D INPUT -i $WIFI_INTERFACE -p udp --dport $ZERONET_PORT -j ACCEPT
iptables -D INPUT -i $WIFI_INTERFACE -p tcp --dport $ZERONET_PORT -j ACCEPT
iptables -D INPUT -i $WIFI_INTERFACE -p udp --dport $TRACKER_PORT -j ACCEPT
@ -563,33 +557,12 @@ function mesh_zeronet {
# publish regularly
MESH_SYNC_COMMAND=$rootdir/usr/bin/mesh-sync
echo '#!/bin/bash' > $MESH_SYNC_COMMAND
echo 'while true' >> $MESH_SYNC_COMMAND
echo 'do' >> $MESH_SYNC_COMMAND
echo '/usr/local/bin/toxavahi 2> /dev/null' >> $MESH_SYNC_COMMAND
echo ' sleep 10' >> $MESH_SYNC_COMMAND
echo '/usr/local/bin/zeronetavahi 2> /dev/null' >> $MESH_SYNC_COMMAND
echo ' sleep 10' >> $MESH_SYNC_COMMAND
echo 'done' >> $MESH_SYNC_COMMAND
chmod +x $MESH_SYNC_COMMAND
if [ ! -f $rootdir/etc/systemd/system/mesh-sync.service ]; then
MESH_SYNC_FILENAME=$rootdir/etc/systemd/system/mesh-sync.service
echo '[Unit]' > $MESH_SYNC_FILENAME
echo 'Description=mesh-sync - Service publications over avahi' >> $MESH_SYNC_FILENAME
echo 'After=network.target' >> $MESH_SYNC_FILENAME
echo '' >> $MESH_SYNC_FILENAME
echo '[Service]' >> $MESH_SYNC_FILENAME
echo 'User=root' >> $MESH_SYNC_FILENAME
echo 'ExecStart=/usr/bin/mesh-sync' >> $MESH_SYNC_FILENAME
echo 'Restart=on-failure' >> $MESH_SYNC_FILENAME
echo 'SuccessExitStatus=3 4' >> $MESH_SYNC_FILENAME
echo 'RestartForceExitStatus=3 4' >> $MESH_SYNC_FILENAME
echo '' >> $MESH_SYNC_FILENAME
echo '[Install]' >> $MESH_SYNC_FILENAME
echo 'WantedBy=multi-user.target' >> $MESH_SYNC_FILENAME
chroot "$rootdir" systemctl enable mesh-sync.service
fi
cron_add_mins 1 "$MESH_SYNC_COMMAND"
cron_add_mins 1 "( sleep 30 ; $MESH_SYNC_COMMAND )"
chroot "$rootdir" systemctl enable tracker.service
chroot "$rootdir" systemctl enable zeronet.service