I wrote a simple script in order to log the date and time of every Pi boot into a text file. I placed the script into /etc/rc.local in order to have it execute on boot.
Here's the script:
#!/bin/sh FILEPATH=/home/pi/bootups.txt DATE=$(date +"%m.%d.%y") TIME=$(date +"%l:%M %P") $(echo $DATE'\t'$TIME >> $FILEPATH)
I call the script in rc.local using this line:
After every Pi boot, the DATE and TIME variable never change. I end up with a text file looking like:
07.12.16 11:17pm 07.12.16 11:17pm 07.12.16 11:17pm
When I call the script on my own, the DATE and TIME update as expected.