Is there a way to get the last time my raspberry pi connects to the wifi network defined in wpa_supplicant.conf?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
The solution is to install an NTP client, and configure a script on the directories that have scripts to run after the interfaces go up.
You would want to execute a script after the interface goes up.
If In Debian do:
$sudo apt-get install ntpdate
The create the following script with vi
sudo vi /etc/network/if-up.d/ntpdate
and place in the vi file the command:
ntpdate -b ntp_server_IP
then finish with:
sudo chmod a+rx /etc/network/if-up.d/ntpdate
Please not the whilst there are other ntp clientes, the ntpdate choice is not accidental. ntpdate -b permits to raise/bump the time on your system in one go without it having being done in small bumps.