run .sh script at reboot with crontab not working Topic is solved

Having issues with your DietPi installation or found a bug? Post it here.
Post Reply
Posts: 4
Joined: Sun Apr 05, 2020 6:22 pm

run .sh script at reboot with crontab not working

Post by QLink »

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:

Code: Select all

cd backlight_dimmer
./timeout 10 event0
then i 've run crontab -e and created following entry:

Code: Select all

@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
User avatar
Posts: 3776
Joined: Sat Nov 16, 2019 12:49 am

Re: run .sh script at reboot with crontab not working

Post by Joulinar »

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

Code: Select all

/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.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply