0

I have a python file that I would like my Raspberry Pi 3 B to run, the instant that I plug the power cable in. I dont want to have to log in or connect a computer to it before the file starts running. Ive looked around on the internet and a lot of them say to edit the /etc/inittab file, which is a file I dont have on my Raspberry pi. Ive also tried editing raspi-config and set the login to automatic but it still asks for a password when ssh ing in.

Please could someone help me with this?

edit: I didnt mean the "instant" literally, I just would like for it to run without me doing anything to it after it is plugged in.

mnt
  • 93
  • 7

1 Answers1

1

It can not be done.

When power is applied the Pi will boot. The boot process takes several seconds. As part of the boot process the operating system (normally Linux) is launched. You can only run a Python script once the operating system has launched.

Depending on the Pi model this will be, say, 10-30 seconds after power has been applied.

joan
  • 71,852
  • 5
  • 76
  • 108