Luanas Posted April 23 Share Posted April 23 Hello. After renaming the name of the script in the section where user scripts are located, the file is not renamed and the original name remains. Do you can fix it, please? Quote Link to comment
sasbro97 Posted Saturday at 08:37 PM Share Posted Saturday at 08:37 PM On 4/17/2024 at 12:13 AM, Amane said: Hi sasbro Cron jobs do not run with the full user environment, which means some environment variables needed by docker or your script might not be set correctly. This can affect the execution of commands that rely on these variables. Add the line on top of your script: PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin I hope it helps. If not, test whether you can copy the script into the container and execute it with the scheduled user script - just for test Grüsse Hey as I told you it worked. At least I thought so. Now after many days I realized again it did not work. I changed the schedule now once to run it in a few minutes also opened the script and closed it again without changes. Now it worked again. I guess unfortunately again just once. What the hell is causing this behavior? I added the PATH line. I feels like some kind of cache or something. Quote Link to comment
Amane Posted Sunday at 08:20 AM Share Posted Sunday at 08:20 AM (edited) 11 hours ago, sasbro97 said: Hey as I told you it worked. At least I thought so. Now after many days I realized again it did not work. I changed the schedule now once to run it in a few minutes also opened the script and closed it again without changes. Now it worked again. I guess unfortunately again just once. What the hell is causing this behavior? I added the PATH line. I feels like some kind of cache or something. Ok... I would extend the logging so that you create a log file in the "/config" folder, i.e. the one that is mapped in appdata. #!/bin/bash #description=This script updates all apps in Nextcloud. #arrayStarted=true #name=Nextcloud Auto-Update Apps CONTAINER_LOGFILE="/config/auto_update_script.log" echo "Script PATH: $(printenv PATH)" docker exec -u www-data nextcloud echo -e "\nStart: $(date)" >> $CONTAINER_LOGFILE docker exec -u www-data nextcloud echo -e "\nDocker PATH: $(printenv PATH)" >> $CONTAINER_LOGFILE docker exec -u www-data nextcloud echo -e "\napp:update output:" >> $CONTAINER_LOGFILE docker exec -u www-data nextcloud php /var/www/html/occ app:update --all >> $CONTAINER_LOGFILE 2>&1 docker_exit_status=$? if [ $docker_exit_status -eq 0 ]; then curl -fsS -m 10 --retry 5 --data-raw "$m" http://unraid-server:8003/ping/1505e87d-84e2-4806-a2a0-fa214d96cb17 echo -e "\nScript succeeded" fi On 4/16/2024 at 10:10 PM, sasbro97 said: OK Script succeeded This issue is particularly interesting, as it is otherwise not logged?! docker exec -u www-data nextcloud php /var/www/html/occ app:update --all >> $CONTAINER_LOGFILE 2>&1 Edited Sunday at 08:37 AM by Amane Quote Link to comment
Amane Posted Sunday at 08:57 AM Share Posted Sunday at 08:57 AM (edited) @sasbro97 Ok i have test the PATH and i see that: Manual Script PATH: /usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin Cron Script PATH: .:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin So test: PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" That also works: On 4/17/2024 at 3:22 PM, JoeUnraidUser said: #!/bin/bash -l source /root/.bash_profile But check the docker PATH with the script above Edited Sunday at 09:04 AM by Amane Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.