I have a problem with an embedded computer where it does not have a separate Real Time Clock and as such every time I reboot it, it loses track of the current date. This is very annoying because lots of processes depend on checking file time stamps.
I can connect to this machine through ssh and and can manually set the date every time I login but it is tedious and prone to forgetting and creating havoc on the time stamps. The machine with no date is the ssh server and I connect with my PC as an SSH client.
What I want is to know is how to set the date on the remote server(embedded machine) with the date of the SSH client (my laptop) automatically upon login.
I thought I should do it by setting the ssh_config of my client to execute a LocalCommand but from what I read in the man it does not work as I want. The command would be like the one described in this question but with the date.
The other way I thought would be that the .profile of the user I connect to the remote machine would try to connect back to my laptop and run date to update it's date.
How should I accomplish this?
ntpdate
orrdate
once, during startup, to get the date right.