run .sh script at reboot with crontab not working

hi guys,

i’m trying to run a script at startup/reboot with crontab but it doesn’t seem to work.

i’ve installed follow tool to turn of backlight after time X:

when i run the command manually in terminal it works fine: ./timeout 10 event0

then i’ve created a script in /var/lib/dietpi/-autostart/ with the following content:

cd backlight_dimmer
./timeout 10 event0

then i 've run crontab -e and created following entry:

@reboot sleep 30 && sudo /var/lib/dietpi/-autostart/

i saved crontab with STR + O into /tmp/crontab.4FRlb3/crontab

but when i reboot diepi nothing happens …

i’m new to this and googled all the above steps. did i misunderstand something ?

best regards

well I guess you would need to specify the full script path inside your .sh file like

/var/lib/dietpi/-autostart/backlight_dimmer/timeout 10 event0

Next to that you could try place your script at /var/lib/dietpi/postboot.d/.Files places in this folder should be execute as post boot step. You would need to ensure that the .sh file hast sufficient execution rights.