I have a problem with start python script just after startup raspberry pi. I've try with init.d, rc.local and cron. No way worked.
My script waiting for input and save it to file:
import datetime
path = '/my/path/to/file.csv'
while 1:
name = input()
date = datetime.datetime.now().strftime('%Y-%m-%d %H-%M-%S')
presence = str(name) + ";" + str(date) + '\n'
print(presence)
file = open(path, "a+")
file.write(presence)
file.close()
How I can run it after startup and the script will be waiting for input all the time.
Cron:
sudo crontab -e
@reboot python /home/pi/Desktop/myscript.py
rc.local:
python /home/pi/Desktop/myscript.py
while
loop? Is it meant to continually ask for input? – Chris