problem with AutoStart Custom.sh after update

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
bumtras
Posts: 2
Joined: Thu Jan 31, 2019 6:33 pm

problem with AutoStart Custom.sh after update

Post by bumtras »

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

Code: Select all

#!/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

Code: Select all

custom.sh start
After I remove my script from Custom.sh

startup.txt

Code: Select all

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! :)

*Sorry if my English is bad!
User avatar
MichaIng
Site Admin
Posts: 2422
Joined: Sat Nov 18, 2017 6:21 pm

Re: problem with AutoStart Custom.sh after update

Post by MichaIng »

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.
bumtras
Posts: 2
Joined: Thu Jan 31, 2019 6:33 pm

Re: problem with AutoStart Custom.sh after update

Post by bumtras »

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:

Code: Select all

#!/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. :D

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