1

I need to run code located /home/pi/Hello_on_startup.py each time RaspberryPi restarts

For that I created hello.conf file in /etc/init/ directory

description "A script controlled by upstart"
author "Anton"

start on runlevel [2345]
stop on runlevel [016]

respawn

exec /home/pi/Hello_on_startup.py`

When I run command sudo start hello I get an answer Unknown job: hello

1 Answers1

0

You need a script...end script block in your conf file for it to be recognised, as shown here. Your resulting hello.conf file would look as follows:

description "A script controlled by upstart"
author "Anton"

start on runlevel [2345]
stop on runlevel [016]

respawn

script
    exec /home/pi/Hello_on_startup.py`
end script

There is also a similar question on AskUbuntu.

Community
  • 1
  • 1
mfitzp
  • 15,275
  • 7
  • 50
  • 70