I am using a Raspberry Pi4 with
Linux raspberrypi 4.19.58-v7l+ #1245 SMP Fri Jul 12 17:31:45 BST 2019 armv7l GNU/Linux.
I have a service that starts a C++ program. This program starts a script, reads content from some files and outputs information on a RGB LED Display.
This is the script:
#!/bin/bash line=$(head -n 1 /var/www/html/configuration.txt) file=/var/www/html/4panel/url_response.txt if [ -f "$file" ]; then wget -q -i $line -O $file chown pi:pi $file else echo > $file chown pi:pi $file fi
I need to do
wget periodically because that URL sends the information that I need to output on the Display. In order to do this, I call this script from inside the C++ program with:
But after some time
url_response.txt gets empty and remains empty until I restart the service. Meaning that the script isn't working properly.
This is the service:
[Unit] Description=PPD_Display service After=multi-user.target [Service] ExecStart=/var/www/html/4panel/Big_ppd_display_try1 [Install] WantedBy=multi-user.target
A weird thing that I've noticed is that the script runs two times, and maybe that's why it stops working properly:
root 26849 0.0 0.0 1940 364 ? S 12:55 0:00 sh -c /var/www/html/4panel/get_page.sh root 26850 0.0 0.1 7808 2580 ? S 12:55 0:00 /bin/bash /var/www/html/4panel/get_page.sh
And if that is not the problem, then why does the script just stops working correctly if the service is still running ?