drchips Posted July 11, 2022 Share Posted July 11, 2022 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.. Quote Link to comment
dlandon Posted July 11, 2022 Share Posted July 11, 2022 An update to UD Preclear is probably causing this problem. Update UD Preclear and reboot. All should be good again. 1 Quote Link to comment
Opawesome Posted July 12, 2022 Share Posted July 12, 2022 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 Quote Link to comment
Cobragt88 Posted July 12, 2022 Share Posted July 12, 2022 Hi I'm just start having a problem with this. Run in background does not work. click run script works. Quote Link to comment
Opawesome Posted July 12, 2022 Share Posted July 12, 2022 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' ? Quote Link to comment
kennymc.c Posted July 13, 2022 Share Posted July 13, 2022 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 Quote Link to comment
MagicMayo Posted July 17, 2022 Share Posted July 17, 2022 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. Quote Link to comment
touz Posted July 25, 2022 Share Posted July 25, 2022 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. Quote Link to comment
vvolfpack Posted July 25, 2022 Share Posted July 25, 2022 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? Quote Link to comment
JonathanM Posted July 25, 2022 Share Posted July 25, 2022 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. Quote Link to comment
Braulio Dias Ribeiro Posted July 30, 2022 Share Posted July 30, 2022 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 Quote Link to comment
MagicMayo Posted July 31, 2022 Share Posted July 31, 2022 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! Quote Link to comment
CBPXXIV Posted August 5, 2022 Share Posted August 5, 2022 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?? Quote Link to comment
KnifeFed Posted August 6, 2022 Share Posted August 6, 2022 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. Quote Link to comment
CBPXXIV Posted August 6, 2022 Share Posted August 6, 2022 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. Quote Link to comment
mgutt Posted August 7, 2022 Share Posted August 7, 2022 @Squid Not really a problem, but it seems that scripts are not deleted from /tmp after they were removed through the GUI. Quote Link to comment
ameer Posted August 7, 2022 Share Posted August 7, 2022 (edited) 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, 2022 by ameer Quote Link to comment
hawihoney Posted August 9, 2022 Share Posted August 9, 2022 @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. Quote Link to comment
MagicMayo Posted August 11, 2022 Share Posted August 11, 2022 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 Quote Link to comment
MagicMayo Posted August 14, 2022 Share Posted August 14, 2022 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` 1 Quote Link to comment
jeffafett Posted August 19, 2022 Share Posted August 19, 2022 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 Quote Link to comment
Andrea3000 Posted August 21, 2022 Share Posted August 21, 2022 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 Quote Link to comment
Squid Posted August 21, 2022 Author Share Posted August 21, 2022 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 Quote Link to comment
Andrea3000 Posted August 21, 2022 Share Posted August 21, 2022 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.. Quote Link to comment
Squid Posted August 22, 2022 Author Share Posted August 22, 2022 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) 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.