Skip to content

Commit

Permalink
add OLSRd core dump garbage collectiong (#173)
Browse files Browse the repository at this point in the history
the OLSR daemon in the 1.0.x firmware dumps a core whenever it
crashes.  This can slowly kill a router as it runs out of memory.  For the
1.0.x firmwares, the function r1_0_2_add_olsrd_garbage_collection has been
added

the OLSR daemon for the 1.1.x firmware does not have this issue.  For 1.1.x
firmwares, the function r1_1_0_remove_olsrd_garbage_collection to undo the
garbage collection.

The garbage collection is done as a cron job which runs daily at 04:23

This addresses issue freifunk-berlin/firmware#642
  • Loading branch information
pmelange authored and SvenRoederer committed Dec 20, 2018
1 parent 212db23 commit 15b1fbb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion defaults/freifunk-berlin-olsrd-defaults/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=freifunk-berlin-olsrd-defaults
PKG_VERSION:=0.0.4
PKG_VERSION:=0.0.5
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,6 @@ test -d /etc/iproute2/ || mkdir -p /etc/iproute2/
grep -q "111 olsr" $tables || echo "111 olsr" >> $tables
grep -q "112 olsr-default" $tables || echo "112 olsr-default" >> $tables
grep -q "113 olsr-tunnel" $tables || echo "113 olsr-tunnel" >> $tables

# add core dump garbage collection (issue #642)
echo "23 4 * * * rm -f /tmp/olsrd*core" >> /etc/crontabs/root
2 changes: 1 addition & 1 deletion utils/freifunk-berlin-migration/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=freifunk-berlin-migration
PKG_VERSION:=0.5.0
PKG_VERSION:=0.5.1
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,12 +405,26 @@ r1_0_2_notunnel_macaddr() {
fi
}


r1_0_2_update_dns_entry() {
log "updating DNS-servers for interface dhcp from profile"
uci set network.dhcp.dns="$(uci get "profile_$(uci get freifunk.community.name).interface.dns")"
}

r1_0_2_add_olsrd_garbage_collection() {
crontab -l | grep "rm -f /tmp/olsrd\*core"
if [ $? == 1 ]; then
log "adding garbage collection of core files from /tmp"
echo "23 4 * * * rm -f /tmp/olsrd*core" >> /etc/crontabs/root
/etc/init.d/cron restart
fi
}

r1_1_0_remove_olsrd_garbage_collection() {
log "removing garbage collection of core files from /tmp"
crontab -l | grep -v "rm -f /tmp/olsrd\*core" | crontab -
/etc/init.d/cron restart
}

migrate () {
log "Migrating from ${OLD_VERSION} to ${VERSION}."

Expand Down Expand Up @@ -468,6 +482,7 @@ migrate () {
r1_0_2_notunnel_ffuplink_ipXtable
r1_0_2_notunnel_macaddr
r1_0_2_update_dns_entry
r1_0_2_add_olsrd_garbage_collection
guard "ffberlin_uplink"
fi

Expand Down

0 comments on commit 15b1fbb

Please sign in to comment.