Is there a way to get the last time my raspberry pi connects to the wifi network defined in wpa_supplicant.conf?



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.

| improve this answer | |
  • Why the ntp client to get the date? – Matteo Nov 20 '15 at 18:06
  • NTP is THE Internet-wide standard to keep equipments synced in time. – Rui F Ribeiro Nov 20 '15 at 18:08
  • Yeah i know what ntp is. But i didn't understand how and where is the time of connection saved. – Matteo Nov 20 '15 at 18:11
  • After the script you provided is being executed – Matteo Nov 20 '15 at 18:11
  • ntpdate gets the time from a NTP server and sets the time with that data in a Unix server. – Rui F Ribeiro Nov 20 '15 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.