problem with AutoStart Custom.sh after update

Hi!
After update from 6.19.x to 6.20.5 and later to 6.20.6, a script that I added to Custom.sh refuses to start. I am not sure after which update it happened.
Custom.sh runs the commands before my script, but stops when reach it.
Example:
Custom.sh

#!/bin/bash
#---Examples---

# - Chromium
#xinit chromium

# - LXDE
#startx

# - Print hello
#echo -e "Hello"

#---Put your code below this line---

#sudo mount /dev/sda1 /media/usb_hdd

sudo echo 'custom.sh start' >> /home/dietpi/startup.txt

sudo /home/dietpi/custom-fan-control.sh

sudo echo 'custom.sh end' >> /home/dietpi/startup.txt

startup.txt

custom.sh start

After I remove my script from Custom.sh

startup.txt

custom.sh start
custom.sh end

If manually run my script it works.
Also my script is running in infinite loop, may that be the problem?

Thanks! :slight_smile:

*Sorry if my English is bad!

What you mean by infinite loop?

You should see related output on the terminal at end of boot stage. Also check: systemctl status dietpi-autostart_custom

And finally if you could paste the output of your script, we could run some local tests. In some cases systemd units/services behave different than running a script/command directly from shell.

Unfortunately my sd card died (this is my 3dr dead card) and I can’t get any data out of it, nigher I have a backup. It would take a while until I get a new one and reproduce the same setup.
If you still want to run your tests, my script was something like that:

#!/bin/bash

gpio mode 0 out

while(sleep 10)
do

temperature=$(< /sys/devices/virtual/thermal/thermal_zone1/temp)
lineToLog="FAN-"

if [ $temperature -gt 45 ]
then
    lineToLog+="ON-"
    lineToLog+="$temperature"
    echo $lineToLog $(date) >> logfan.txt                                   
    gpio write 0 1                                                 
else
#    lineToLog+="OFF-"
#    lineToLog+="$temperature"
#    echo $lineToLog $(date) >> logfan.txt
    gpio write 0 0                                                                                                              
fi
done

I am not sure if this would work, cuz I can’t test it right now. :smiley:

Also I forget to mention that I was using Orange Pi Zero.