I am trying to automatically set a date after boot on an embeddd linux with busybox ( I dont have a RTC).
I also dont have
ntp command in busybox, nor curl. My
wget is very limited too, and I cant seem to get headers with it.
I have seen multiple ways that use
wget that parse the header of google.com to get the current date.
wget command doesnt support
BusyBox v1.21.0 (2014-11-25 08:52:04 CET) multi-call binary. Usage: wget [-c|--continue] [-s|--spider] [-q|--quiet] [-O|--output-document FILE] [--header 'header: value'] [-Y|--proxy on/off] [-P DIR] [-U|--user-agent AGENT] [-T SEC] URL... Retrieve files via HTTP or FTP -s Spider mode - only check file existence -c Continue retrieval of aborted transfer -q Quiet -P DIR Save to DIR (default .) -T SEC Network read timeout is SEC seconds -O FILE Save to FILE ('-' for stdout) -U STR Use STR for User-Agent header -Y Use proxy ('on' or 'off')
I this solution somewhere, but I only have POSIX shell, not bash, so it doesnt work (
can't create /dev/tcp/www.google.com/80: nonexistent directory):
#!/bin/bash exec 5<>/dev/tcp/www.google.com/80 cat mypostfile >&5 cat <&5 # reply
Any ideas how I can still retrieve the current date from somewhere so I can set my system clock with my busybox?