[Commotion-admin] [olsrd] Apparent OLSR sensitivity to node local time (#9)

Ben West notifications at github.com
Thu Oct 17 15:29:35 UTC 2013


An ugly hack that may work is to scan files in /etc/* on boot, or wherever relevant, and extract the most recent modification date.  Then set local time to that datetime, if local time is older.  This would depend on just how large of a time offset olsrd-mod-mdp will tolerate.

Here is /etc/rc.local with said ugly hack, in use on TP-Link TL-MR3020's, which don't preserve local time across reboot.  You would likely want to add an if statement first verifying whether the local time is indeed older.

```
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

# Get date/time components of most recent filemod under /etc/update
FILELISTING=`ls -lr -u -e /etc/ | tail -1`
[ -n "${FILELISTING}" ] && {
	FILEMOD_YYYY=`echo $FILELISTING | awk '{printf "%d", $10}'`
	FILEMOD_HHMMSS=`echo $FILELISTING  | awk '{printf "%s", $9}'`
	FILEMOD_DD=`echo $FILELISTING | awk '{printf "%s", $8}'`
	FILEMOD_MONTH=`echo $FILELISTING | awk '{printf "%s", $7}'`

	# Convert Month to numerical MM format
	case "${FILEMOD_MONTH}" in
		"Jan") FILEMOD_MM="01" ;;
		"Feb") FILEMOD_MM="02" ;;
		"Mar") FILEMOD_MM="03" ;;
		"Apr") FILEMOD_MM="04" ;;
		"May") FILEMOD_MM="05" ;;
		"Jun") FILEMOD_MM="06" ;;
		"Jul") FILEMOD_MM="07" ;;
		"Aug") FILEMOD_MM="08" ;;
		"Sep") FILEMOD_MM="09" ;;
		"Oct") FILEMOD_MM="10" ;;
		"Nov") FILEMOD_MM="11" ;;
		"Dec") FILEMOD_MM="12" ;;
		*) FILEMOD_MM="01" ;;
	esac
	
	# Set local date/time, assuming format "YYYY-MM-DD hh:mm:ss"
	DATE="${FILEMOD_YYYY}-${FILEMOD_MM}-${FILEMOD_DD} $FILEMOD_HHMMSS"
	date -s "${DATE}"
}
```


---
Reply to this email directly or view it on GitHub:
https://github.com/opentechinstitute/olsrd/issues/9#issuecomment-26517343
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.chambana.net/pipermail/commotion-admin/attachments/20131017/cd6b6488/attachment.html>


More information about the Commotion-admin mailing list