Run a script at the boot of system

I want run my script.sh during the boot of my jetson.

So I add the script on /etc/init.d/

chmode 755 script.sh

update-rc.d script.sh defaults

and nothing happen.

My script is very sample

#!/bin/bash

mkdir /home/mbdilepix/mamamia

Why it don’t work ?

Perhaps it is running before the file system is mounted read-write. Also, if this already exists, the command would have an error. Or if some of the parent directories don’t exist, then this would be an error. Try changing to:

/bin/mkdir -p /home/mbdilepix/mamamia

(if that works you might also consider explicit settings of permissions)

I tried enabling a simple service on my TX2 with L4T 32.1 with update-rc.d and it didn’t seem to run. Some of
the other files in /etc/init.d did seem to show up with systemctl status. I don’t know
enough about systemd to know how to troubleshoot it.

We start our application with a systemd service file that we install in /usr/lib/systemd/service.

It’s a little more work, but then you can start/stop/enable/disable/status with systemctl,
and you have control over when it runs. the .service file is something like this.

[Unit]
Description=System Control
After=syslog.target network.target

[Service]
WorkingDirectory=/opt/syscontrol
Type=simple
RemainAfterExit=true
ExecStart=/opt/syscontrol/syscontrol_process
Restart=always

[Install]
WantedBy=multi-user.target

You would want to change it a little for a one-shot action.

systemd takes some getting used to, but it’s the way most things are nowadays.

I would agree with @cobrien…if you can do so, then systemd is the cleanest (or most modern way) to add things to run as a service. This also allows you to mark other services as dependencies (e.g., X11 running or network running as prerequisite).

ok thank you