Can't figure out how to set up autostart?

I have installed dietpi successfully and I would like to run the command “sh /root/start.sh” automatically when the pi is turned on.

start.sh currently contains one line, “mkdir /root/testdir”, just to test that it works.

I have tried typing “sudo dietpi-autostart”, which opens the auto start window. I selected Custom: /etc/dietpi/autostart.sh. The screen cleared for a second, no text, then back to the DietPi-AutoStart menu. I exited. I then ran “sudo nano /etc/dietpi/autostart.sh”, and in that file I have “sh /root/start.sh”. I Ctrl-O, Ctrl-X’d and rebooted. I logged in, then tried “ls”, and I don’t have the testdir folder. Ideas?

I found a dirty solution by adding the line “/bin/sh /root/autostart.sh &” to the file “/DietPi/dietpi/boot”.

Not the best solution as the boot file could be updated and your startup script then wouldn’t run.

Cron will do the job - there are many tutorials on this such as:

https://www.raspberrypi.org/documentation/linux/usage/cron.md

Skip the bit on gnome-schedule and concentrate on crontab -e.

John

does any changes occur to /etc/rc.local?