Auto Run a file on Boot on Dietpi Topic is solved

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
cktechie
Posts: 37
Joined: Tue Jan 05, 2021 1:34 am

Auto Run a file on Boot on Dietpi

Post by cktechie »

Hi!

On regular Raspberry Pi image (for headless / no monitor setup) , there is option to run a local file on boot using the entry on /etc/rc.local

on Dietpi, I dont find the file. How do I run a file on boot.

Do I use the dietpi-autostart to use a custom.sh?
Does this run the file in background or does this only work on console / desktop?

Thanks for your help!
User avatar
Joulinar
Posts: 3688
Joined: Sat Nov 16, 2019 12:49 am

Re: Auto Run a file on Boot on Dietpi

Post by Joulinar »

Hi,

basically /etc/rc.local has been deprecated and is not used anymore to start service during boot process. Nowadays this is done by systemd. Even Raspberry Pi Foundation is not recommending the usage https://www.raspberrypi.org/documentati ... c-local.md

You have following options to get a script running during boot
  1. create your own service using systemd
    1. https://www.raspberrypi.org/documentati ... systemd.md
    2. https://www.troublenow.org/752/debian-10-add-rc-local/
  2. using crontab to have a script exeuted during boot https://phoenixnap.com/kb/crontab-reboot
  3. dietpi-config AutoStart Option - Custom, will create as well a systemd service dietpi-autostart_custom and can be used to execute your command at boot
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
cktechie
Posts: 37
Joined: Tue Jan 05, 2021 1:34 am

Re: Auto Run a file on Boot on Dietpi

Post by cktechie »

Thank you Joulinar !!
Post Reply