0

I have an LED strip connected to my Raspberry Pi Zero W, and I would like to run a Python script to turn on the LED’s as soon as possible after boot.

In my systemd unit file, I’m using After=multi-user.target, but I’m wondering if there is an earlier target that I can be using.

  • This Question is not Pi specific, and is unanswerable. It depends on what the script does. "Earlier" is a meaningless concept in systemd. – Milliways Jul 25 at 23:41
  • 1
    I normally set things up with After=network.target and WantedBy=multi-user.target and let systemd work out when to start my service. – Dougie Jul 27 at 16:35
2

I would say the earliest usable target is the sysinit.target. But because there is nothing known about the needed resources of the LED strip it may fail. You can try other targets. The next could be the basic.target or some others between them, e.g. the sockets.target. Have a look at systemd bootup — System bootup process what targets can be used and try what's the earliest one for your project.

| improve this answer | |

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.