Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
127 additions
and
46 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
...s/shared-state-bat_hosts/files/etc/shared-state/publishers/shared-state-publish_bat_hosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../usr/bin/shared-state-publish_bat_hosts |
10 changes: 8 additions & 2 deletions
10
packages/shared-state-bat_hosts/files/etc/uci-defaults/shared-state-bat_hosts-cron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
#!/bin/sh | ||
|
||
echo "*/5 * * * * ((sleep $(($RANDOM % 120)); shared-state sync bat-hosts)&)" >> /etc/crontabs/root | ||
echo "*/30 * * * * ((sleep $(($RANDOM % 1000)); shared-state-publish_bat_hosts)&)" >> /etc/crontabs/root | ||
unique_append() | ||
{ | ||
grep -qF "$1" "$2" || echo "$1" >> "$2" | ||
} | ||
|
||
unique_append \ | ||
'*/5 * * * * ((sleep $(($RANDOM % 120)); shared-state sync bat-hosts)&)'\ | ||
/etc/crontabs/root |
1 change: 1 addition & 0 deletions
1
...-state-dnsmasq_hosts/files/etc/shared-state/publishers/shared-state-publish_dnsmasq_hosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../usr/bin/shared-state-publish_dnsmasq_hosts |
11 changes: 9 additions & 2 deletions
11
packages/shared-state-dnsmasq_hosts/files/etc/uci-defaults/shared-state-dnsmasq_hosts-cron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
#!/bin/sh | ||
echo "*/5 * * * * ((sleep $(($RANDOM % 120)); shared-state sync dnsmasq-hosts)&)" >> /etc/crontabs/root | ||
echo "*/30 * * * * ((sleep $(($RANDOM % 1000)); shared-state-publish_dnsmasq_hosts)&)" >> /etc/crontabs/root | ||
|
||
unique_append() | ||
{ | ||
grep -qF "$1" "$2" || echo "$1" >> "$2" | ||
} | ||
|
||
unique_append \ | ||
'*/5 * * * * ((sleep $(($RANDOM % 120)); shared-state sync dnsmasq-hosts)&)'\ | ||
/etc/crontabs/root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...tate-dnsmasq_leases/files/etc/shared-state/publishers/shared-state-publish_dnsmasq_leases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../usr/bin/shared-state-publish_dnsmasq_leases |
17 changes: 15 additions & 2 deletions
17
packages/shared-state-dnsmasq_leases/files/etc/uci-defaults/90_dnsmasq-lease-share
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
#!/bin/sh | ||
|
||
dhcpHostsFile="/tmp/dhcp.hosts_remote" | ||
|
||
uci set dhcp.@dnsmasq[0].dhcpscript=/usr/bin/dnsmasq-lease-share.sh | ||
uci set dhcp.@dnsmasq[0].dhcphostsfile=/tmp/dhcp.hosts_remote | ||
uci set dhcp.@dnsmasq[0].dhcphostsfile=$dhcpHostsFile | ||
uci commit dhcp | ||
|
||
echo "*/5 * * * * ((sleep $(($RANDOM % 120)); shared-state sync dnsmasq-leases)&)" >> /etc/crontabs/root | ||
unique_append() | ||
{ | ||
grep -qF "$1" "$2" || echo "$1" >> "$2" | ||
} | ||
|
||
# needed because init script ignore +dhcphostsfile+ if the file doesn't exists | ||
unique_append "dhcp-hostsfile=$dhcpHostsFile"\ | ||
"/etc/dnsmasq.d/shared-state-dhcp-leases" | ||
|
||
unique_append \ | ||
'*/5 * * * * ((sleep $(($RANDOM % 120)); shared-state sync dnsmasq-leases)&)'\ | ||
/etc/crontabs/root | ||
|
||
exit 0 |
2 changes: 1 addition & 1 deletion
2
packages/shared-state-dnsmasq_leases/files/usr/bin/dnsmasq-lease-share.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#!/bin/sh | ||
((shared-state-publish_dnsmasq_leases $@; shared-state sync dnsmasq-leases)&) | ||
((shared-state-publish_dnsmasq_leases $@; shared-state sync dnsmasq-leases; shared-state sync dnsmasq-hosts)&) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/shared-state/files/etc/uci-defaults/shared-state-publishers-cron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
unique_append() | ||
{ | ||
grep -qF "$1" "$2" || echo "$1" >> "$2" | ||
} | ||
|
||
unique_append \ | ||
'*/30 * * * * ((sleep $(($RANDOM % 1000)); for publisher in /etc/shared-state/publishers/* ; do [ -x "$publisher" ] && "$publisher"; done )&)'\ | ||
/etc/crontabs/root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters