Jetson nano auto run python code when power up

In my project. I want to run python3 code( especially AI code) when power up on jetson nano.
Can anyone help me how to do that. Tks a lot :)

1 Like


Jetson is a L4T (Linux for Tegra) system so you can setup the startup program similar to Linux system.
Here is a related topic for your reference:


Hi AastaLL
I have read this post. It make me so confused. Can you describe in detail how to use this ?
Thanks & BR.

How to make something run on boot with systemd systems:

  1. Create a file named “/usr/local/bin/” with the commands you need to run on start:
$ sudo nano /usr/local/bin/
$ sudo chmod +x /usr/local/bin/
  1. Create a file called “/etc/systemd/system/mything.service”

  2. In this file, put this text:

Description=mything: do my own thing



(If your thing needs the X windows GUI to be running, change all “” to be “” in the above file)

  1. Run these two commands in a shell:
$ sudo systemctl enable mything.service
$ sudo systemctl start mything.service

Hi snarky.
so how I can interrup it when i want ?? Meaning I want to stop after it runs for a while to edit.

It may be desirable to as a dedicated user (root:root is the default). Adding these lines to the [Service] section will accomplish that:


(where foo is some limited user created something like this):

useradd -md /var/foo-data -rUs /bin/false foo

If you need access to the GPU, the user will have to be in the video group:

usermod -a -G video foo

That will create a “foo” system user and group with a home in /var/foo-data where you can put files created by your app. Your app get this path with os.path.expanduser('~') in Python, or like this in C/C++.

so how I can interrup it when i want ?? Meaning I want to stop after it runs for a while to edit.

systemctl stop mything.service

Will send SIGINT to (or whatever the ExecStart line is). Your process can handle that however you chose.

systemctl reload mything.service

Will send SIGHUP so you can use that to reload a configuration for example, without actually stopping your process.

it’s not working

How is it failing?

Hi snarky, I try to config follow you guide, but it’s still not working.
When i check status of mything.service file (via cmd: sudo systemctl status mything.service), the log is displayed:

swarmrobotic@swarmrobotic-desktop:~$ sudo systemctl status mything.service
● mything.service - mything: do my own thing
Loaded: loaded (/etc/systemd/system/mything.service; enabled; vendor preset:
Active: activating (auto-restart) (Result: exit-code) since Thu 2020-04-02 16
Process: 8036 ExecStart=/usr/local/bin/ (code=exited, status=203/EXE
Main PID: 8036 (code=exited, status=203/EXEC)

I see other .service file has Active is actived.
So how can I do anything?
Many thanks.


Hi Guys,

I am trying the same. Nevertheless I got code=exited, status=2.
My code needs runs under a virtual environment , So i had to specify the python path.
When I try the ExcStart line from my terminal it runs, so I discarded the path wasn’t accurate.
Next thought is the my python script requires OpenGL, So I am not sure if that is making this service exit.

I am not being able to autorun YOLOv5 on bootup on my Jetson Nano. I tried the crontab option, can anyone please tell me how to do the same? I am not being able to do it since a while. It has utils and torch both used so is there any solution to autorun it?

Hi pramodisha1,

Please help to open a new topic for your issue. Thanks