July 11, 20223 yr Same situation here but running 6.9.2..... 2 user.scripts set for BackgroundOnly and AfterArrayStart fail to run: Checked using htop, filter for $ScriptName and user.script shows no running processes. Scripts run perfectly using bash /path/to/ScriptName/script & and show in htop. Re-boot and perform tests, and confirmed that the scripts are not starting / running.. Only change to the system was update of Unassigned Devices Preclear ( to version 2022.07.10a ). Nothing in system log to indicate failure to load user.scripts plugin... Thanks in anticipation..
July 11, 20223 yr An update to UD Preclear is probably causing this problem. Update UD Preclear and reboot. All should be good again.
July 12, 20223 yr 4 hours ago, dlandon said: An update to UD Preclear is probably causing this problem. Update UD Preclear and reboot. All should be good again. Hi @dlandon, Indeed, updating with UD Preclear plugin to version 2022.07.11 ("Fix: Revert tmux to 3.1b for Unraid 6.10") fixed the issue with the User Scripts plugin on my system. Many thanks (for this fix, and for your work in general on your plugins). Best regards, OP
July 12, 20223 yr Hi I'm just start having a problem with this. Run in background does not work. click run script works.
July 12, 20223 yr 40 minutes ago, Cobragt88 said: Hi I'm just start having a problem with this. Run in background does not work. click run script works. Have you tried this: 'Update UD Preclear and reboot' ?
July 13, 20223 yr I also noticed this problem with the latest preclear plugin update from Monday (2022.07.11). So it is not possible to update the plugin and reboot. System log looks like this when i try to run a script in the background: Jul 13 08:53:25 smartserver emhttpd: cmd: /usr/local/emhttp/plugins/user.scripts/backgroundScript.sh /tmp/user.scripts/tmpScripts/backup_usb/script Jul 13 08:53:25 smartserver atd[11341]: PAM unable to dlopen(/lib64/security/pam_unix.so): /lib64/libc.so.6: version `GLIBC_2.34' not found (required by /lib64/libresolv.so.2) Jul 13 08:53:25 smartserver atd[11341]: PAM adding faulty module: /lib64/security/pam_unix.so Jul 13 08:53:25 smartserver atd[11341]: Module is unknown
July 17, 20223 yr On 7/2/2022 at 3:42 AM, rbojanssen said: Is it possible to execute a script with a custom cron job on the first Friday of every month? I tried to set the custom schedule to '0 0 23 ? * 6#1 *' but that doesn't work. I get this error. PS The link in the help text "What is Cron" for the online generator doesn't work. You could try this '0 0 1-7 * */5'. This basically says to only run the cron if it falls on the fifth day of the week and only for days 1-7 of the month. Since there's only one Friday a week this should work for you. Also, check out crontab.guru for a cron generator and something to explain the syntax.
July 25, 20223 yr On 3/4/2021 at 9:08 AM, questionbot said: is my script correct? Will that do what I want it to.. simply run my rclone sync thing but if the script is already running... not run it. Like the name of the file is "/boot/config/plugins/user.scripts/scripts/rclone_sync/script" right? so if pgrep -x "/boot/config/plugins/user.scripts/scripts/rclone_sync/script" > /dev/null then #echo "Running" rclone sync /sourceDir remote: else #echo "Stopped" fi were you able to make your logic work? I'm looking to do the exact same thing.
July 25, 20223 yr On 6/2/2022 at 6:40 PM, JonathanM said: docker exec <container name> /full/command/that/works/at/the/container/console Thanks for the tips! I was trying to run this script and it fails when run using User Scripts, but it works when run from within the console of the docker container. User Scripts scheduled script: Fails #!/bin/bash docker exec binhex-qbittorrentvpn curl -c ~/mam.cookies -b ~/mam.cookies https://t.myanonamouse.net/json/dynamicSeedbox.php Script used when running from within the docker container: Successfully works curl -c ~/mam.cookies -b ~/mam.cookies https://t.myanonamouse.net/json/dynamicSeedbox.php Any tips on what I'm doing incorrectly?
July 25, 20223 yr 14 minutes ago, vvolfpack said: Any tips on what I'm doing incorrectly? Not really. Maybe specify the full path to curl? /bin/curl or wherever it happens to live inside the container.
July 30, 20223 yr Hi ladies and gentlemen. How can i read script name that´s running in real time? Is there any command? Example: $name or $ScriptName Remenber: I don't create a variable called (name) in my script. I would like to know the script name that´s running now. Tks
July 31, 20223 yr On 7/25/2022 at 5:13 PM, vvolfpack said: Thanks for the tips! I was trying to run this script and it fails when run using User Scripts, but it works when run from within the console of the docker container. User Scripts scheduled script: Fails #!/bin/bash docker exec binhex-qbittorrentvpn curl -c ~/mam.cookies -b ~/mam.cookies https://t.myanonamouse.net/json/dynamicSeedbox.php Script used when running from within the docker container: Successfully works curl -c ~/mam.cookies -b ~/mam.cookies https://t.myanonamouse.net/json/dynamicSeedbox.php Any tips on what I'm doing incorrectly? You can use sh -c to run it with shell instead of the bare command. So you could try #!/bin/bash docker exec binhex-qbittorrentvpn sh -c 'curl -c ~/mam.cookies -b ~/mam.cookies https://t.myanonamouse.net/json/dynamicSeedbox.php' Don't forget to quote the command!
August 5, 20223 yr On 6/7/2022 at 8:05 PM, CBPXXIV said: I'm having a weird issue. I have strips installs, did it a while back and put some scripts in place. Just went in to settings cause I wanted to check one of them and there is no icon for me to click, it's like it's not installed on my system. If I click on it from the plugins page just goes to /Settings/Userscripts, but it's a blank page. Thoughts? Are my scripts even still running or are they gone? Anyone??
August 6, 20223 yr 22 hours ago, CBPXXIV said: Anyone?? Check if you have "/boot/config/plugins/user.scripts". If so, your scripts should be in the "scripts" folder there, which you can back up and then re-install the plugin.
August 6, 20223 yr 8 hours ago, KnifeFed said: Check if you have "/boot/config/plugins/user.scripts". If so, your scripts should be in the "scripts" folder there, which you can back up and then re-install the plugin. That did it, it actually repopulated the scripts by itself. Thank you.
August 7, 20223 yr @Squid Not really a problem, but it seems that scripts are not deleted from /tmp after they were removed through the GUI.
August 7, 20223 yr I need help to modify the code shown here: https://blog.darkpan.com/posts/fix-google-takeout-photos-and-videos-timestamps/ to works with my situation as the script in unraid is not in the same folder as the link shown above, so I need to modify the code first to direct the script to run the desired folder. in this case (thanks AgentXXL supporting member on discord) changed this line of the code: from dirname=$(dirname "$json_file") To dirname=$(/mnt/user/unraid/homes/googlephoto "$json_file") When running the code it gives me this error: Script location: /tmp/user.scripts/tmpScripts/phototest/script Note that closing this window will abort the execution of this script find: './sys/kernel/slab': Input/output error /tmp/user.scripts/tmpScripts/phototest/script: line 4: /mnt/user/unraid/homes/googlephoto: Is a directory find: './proc/4797/task/4797/net': Invalid argument find: './proc/4797/net': Invalid argument find: './proc/4988': No such file or directory find: './proc/4989': No such file or directory find: './proc/4998/task/4998/net': Invalid argument find: './proc/4998/net': Invalid argument find: 'standard output': Broken pipe find: write error Any help? Note: there is hundreds of json files inside many folders (folder's name have space by the way) Edited August 8, 20223 yr by ameer
August 9, 20223 yr @Squid May I issue a Feature Request: Is it possible to sort the User Scripts by it's title instead of it's filename? I'm running lots of User Scripts and I'm always searching for the requested User Scripts. The following screenshot shows part (!!!) of my User Scripts. I hope you can see the "annoyance". No rant here - in fact I love and use your script heavily. When using lot's of User Scripts there is high chance that you rename the title over time and this is not reflected in the list. Thanks for listening.
August 11, 20223 yr On 8/9/2022 at 4:04 AM, hawihoney said: @Squid May I issue a Feature Request: Is it possible to sort the User Scripts by it's title instead of it's filename? I'm running lots of User Scripts and I'm always searching for the requested User Scripts. The following screenshot shows part (!!!) of my User Scripts. I hope you can see the "annoyance". No rant here - in fact I love and use your script heavily. When using lot's of User Scripts there is high chance that you rename the title over time and this is not reflected in the list. Thanks for listening. @Squid I just submit a change to the code to get this functionality in if you want to look it over
August 14, 20223 yr On 8/7/2022 at 7:59 PM, ameer said: I need help to modify the code shown here: https://blog.darkpan.com/posts/fix-google-takeout-photos-and-videos-timestamps/ to works with my situation as the script in unraid is not in the same folder as the link shown above, so I need to modify the code first to direct the script to run the desired folder. in this case (thanks AgentXXL supporting member on discord) changed this line of the code: from dirname=$(dirname "$json_file") To dirname=$(/mnt/user/unraid/homes/googlephoto "$json_file") When running the code it gives me this error: Script location: /tmp/user.scripts/tmpScripts/phototest/script Note that closing this window will abort the execution of this script find: './sys/kernel/slab': Input/output error /tmp/user.scripts/tmpScripts/phototest/script: line 4: /mnt/user/unraid/homes/googlephoto: Is a directory find: './proc/4797/task/4797/net': Invalid argument find: './proc/4797/net': Invalid argument find: './proc/4988': No such file or directory find: './proc/4989': No such file or directory find: './proc/4998/task/4998/net': Invalid argument find: './proc/4998/net': Invalid argument find: 'standard output': Broken pipe find: write error Any help? Note: there is hundreds of json files inside many folders (folder's name have space by the way) At a minimum I would say you need to set the type you are looking for in the `find` command. In this case, you are looking for a file so you would set the `-type` flag to `f`. Your command would end up looking like `find ./ -name '*.json' -type f`. The other thing it looks like is happening is that this script is running from the root of your file system given the locations it's looking in. The plugin puts your script in a specific directory so you will have to first `cd` into the correct directory in the script or make your find command more explicit in where it's supposed to be "finding" things. If you know where the find command is supposed to be looking I would do that. So that command should look like `find /mnt/user/unraid/homes/googlephoto -name '*.json' -type f`
August 19, 20223 yr I am having the hardest time writing a script as its been a while but I need to just write a script to backup one section to rclone and amazon s3. I successfully did it for my backblaze b2 but it was over a year ago and can not remember for the life of me
August 21, 20223 yr Hi @Squid I think I have encountered a bug with User Scripts. I use the scheduling/Cron feature on 3 of my scripts. - One is set to execute "At first array start only" (and works correctly) - One is set to execute every hour using a custom Cron string "0 * * * *" (and works correctly) - One si set to execute every minute using a custom Cron string "* * * * *" (THIS DOESN'T WORK) The script that is set to execute every minute works the first time I set it up but after a reboot it doesn't get executed. In order for it to work I have to temporarily disable the scheduling, put it back to custom and apply the changes. This works until the following reboot. Would you be able to help me with this? Thanks Andrea
August 21, 20223 yr Author This is what I'm guessing is happening on your system (at least this is what I can see on mine) Your system is not set to autostart the array (Settings - Disk Settings) After you reboot, you're noticing that the script isn't running on a schedule, so you toggle the settings and then it begins to run. If you don't bother doing that, and instead start the array does it then run? (or alternatively, without starting the array, from a command prompt enter in update_cron will it then start. TLDR: Not 100% sure if this is a bug in the OS or by design, but any custom cron schedules done by a plugin do not take effect until the array is started. EDIT: I see this when I was testing on 6.9.2 -> Under 6.11.0-rc3p6 I'm not seeing this same behaviour. Not sure about 6.10.3
August 21, 20223 yr 46 minutes ago, Squid said: This is what I'm guessing is happening on your system (at least this is what I can see on mine) Your system is not set to autostart the array (Settings - Disk Settings) After you reboot, you're noticing that the script isn't running on a schedule, so you toggle the settings and then it begins to run. If you don't bother doing that, and instead start the array does it then run? (or alternatively, without starting the array, from a command prompt enter in update_cron will it then start. TLDR: Not 100% sure if this is a bug in the OS or by design, but any custom cron schedules done by a plugin do not take effect until the array is started. EDIT: I see this when I was testing on 6.9.2 -> Under 6.11.0-rc3p6 I'm not seeing this same behaviour. Not sure about 6.10.3 My array is already set to autostart and it does. After some more digging I found out that: - All the custom schedules weren't working, not just the one that was supposed to run every minute - The issue was due to the syntax of the cron string and I managed to fix it and it is now working. I had to replace: - * * * * * with */1 * * * * - 0 * * * * with 0 */1 * * * - 0 0 1 * * with 0 0 1 */1 * I don't know why the old strings did't work as they should be equally valid..
August 22, 20223 yr Author I tested with * * * * * on 6.9.2 and 6.11 and no issues with it (subject to 6.9 not adding the cron until it was started)
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.