Squid Posted February 27, 2023 Author Share Posted February 27, 2023 6 hours ago, hawihoney said: Output of commands within scripts is not shown with latest User Script plugin. Example: Fixed... Thanks 1 Quote Link to comment
Squid Posted February 27, 2023 Author Share Posted February 27, 2023 11 hours ago, Barry Staes said: Thanks for these wonderful Unraid Plugins! Links updated 11 hours ago, Barry Staes said: I found no link or mention of the Unraid Plugin User Scripts source repository anywhere in the CA, plugin itself, changelog, this plugin forum thread, or your (Squid's) profile. Since I also do CA, I do not publish any URLs to any plugin installation URL. Only CA do I publish the URL (and by implication the GitHub repository) publicly Quote Link to comment
dlparisi Posted February 28, 2023 Share Posted February 28, 2023 17 hours ago, Squid said: Fixed... Thanks No - Thank you! 1 Quote Link to comment
gekoch Posted March 1, 2023 Share Posted March 1, 2023 (edited) I'm running the latest plugin version but since then some scripts do not get executed regularly. I have 5 scripts that should run every minute but one of them is mostly running every 2 minutes and sometimes every 1 minute. How can we fix this? Before the update the scripts were working as intended... EDIT: Most of the script set to a minute interval with "* * * * *" are running in a 2 minute interval at best, and the script takes around 0.1 to 2 seconds of run time. Even after a restart of the whole system the problem still persist. Edited March 2, 2023 by gekoch Quote Link to comment
sunbear Posted March 4, 2023 Share Posted March 4, 2023 On 2/26/2023 at 6:10 AM, Squid said: I'll look at it, but effectively they are both the same thing just opposite ways of wording it. Only use one of them. IMO, having something like the following, #foregroundButton=[true|false] #backgroundButton=[true|false] would make a lot more sense and prevent one of them becoming redundant when you use the other. But my problem isn't about the wording, it's about the fact that if I use the variables at all (regardless of setting) BOTH buttons disappear, preventing me from running the script. It took a bit of fidgeting to realize I had to remove the variables altogether to get the buttons back. Quote Link to comment
Presjar Posted March 9, 2023 Share Posted March 9, 2023 (edited) Is it a problem if a CA script I have set to run on start of the array never completes when I test with "RUN SCRIPT"? During my script I call another script that is first copy into /usr/local/bin In the unraid WEBUI Shell, If I run ./monitor_arrayAudioChanges.sh I am returned to the # prompt and the process runs in background fine. If I close the RUN SCRIPT window the PID started by the monitor_arrayAudioChanges.sh is also terminated. I have tried sever suggestions I found online to have this .sh start in a different way / in background but have had no luck. Any suggestions? Quote Tried - https://stackoverflow.com/questions/8352851/shell-how-to-call-one-shell-script-from-another-shell-script Tried - https://unix.stackexchange.com/questions/269805/how-can-i-detach-a-process-from-a-bash-script ## Install inotify-tools package ## installpkg /boot/packages/inotify-tools-3.22.6.0-x86_64-1.txz ## Setup monitoring of music and audiobooks array folders ## cp -r /boot/custom/audioArrayToSSD /usr/local/bin && chmod +x /usr/local/bin/audioArrayToSSD/sync_arrayAudioToSSD.sh && chmod +x /usr/local/bin/audioArrayToSSD/monitor_arrayAudioChanges.sh source /usr/local/bin/audioArrayToSSD/monitor_arrayAudioChanges.sh ## Install docker compose BLABLABLA Edited March 9, 2023 by Presjar Quote Link to comment
ICDeadPpl Posted March 9, 2023 Share Posted March 9, 2023 8 hours ago, Presjar said: Is it a problem if a CA script I have set to run on start of the array never completes when I test with "RUN SCRIPT"? During my script I call another script that is first copy into /usr/local/bin In the unraid WEBUI Shell, If I run ./monitor_arrayAudioChanges.sh I am returned to the # prompt and the process runs in background fine. If I close the RUN SCRIPT window the PID started by the monitor_arrayAudioChanges.sh is also terminated. I have tried sever suggestions I found online to have this .sh start in a different way / in background but have had no luck. Any suggestions? ## Install inotify-tools package ## installpkg /boot/packages/inotify-tools-3.22.6.0-x86_64-1.txz ## Setup monitoring of music and audiobooks array folders ## cp -r /boot/custom/audioArrayToSSD /usr/local/bin && chmod +x /usr/local/bin/audioArrayToSSD/sync_arrayAudioToSSD.sh && chmod +x /usr/local/bin/audioArrayToSSD/monitor_arrayAudioChanges.sh source /usr/local/bin/audioArrayToSSD/monitor_arrayAudioChanges.sh ## Install docker compose BLABLABLA Use "bash /usr/local/bin/audioArrayToSSD/monitor_arrayAudioChanges.sh" instead of "source /usr/local/bin/audioArrayToSSD/monitor_arrayAudioChanges.sh" From the 1st link you provided: "In the second method, if you are using exit in second script, it will exit the first script as well." Quote Link to comment
Presjar Posted March 9, 2023 Share Posted March 9, 2023 (edited) 1 hour ago, ICDeadPpl said: Use "bash /usr/local/bin/audioArrayToSSD/monitor_arrayAudioChanges.sh" Thanks! I will give that a try. I had previously tried it as per the first link, top answer, point 3. /bin/bash /usr/local/bin/audioArrayToSSD/monitor_arrayAudioChanges.sh Edit: no good unfortunately. Same issue. Link the script im trying to run on array start. Original script was on github. Modified to made it work for my purpose and made it messy. https://pastebin.com/Xu5U9nAB Edited March 9, 2023 by Presjar Updated after testing Quote Link to comment
allenormond Posted March 10, 2023 Share Posted March 10, 2023 (edited) Is there any way for a script to check if it was run manually or on a schedule? Like a variable set to true, only if the script was run manually? Edited March 10, 2023 by allenormond typo Quote Link to comment
explosionhole Posted March 11, 2023 Share Posted March 11, 2023 Installed the User Scripts plugin, and followed the usage / guides to populate the various files. After adding the script and executing it, I cannot now run in the background or schedule it for future runs. Is this a known issue? Is there a fix? Quote Link to comment
Squid Posted March 11, 2023 Author Share Posted March 11, 2023 1 hour ago, explosionhole said: Installed the User Scripts plugin, and followed the usage / guides to populate the various files. After adding the script and executing it, I cannot now run in the background or schedule it for future runs. Is this a known issue? Is there a fix? Works for me. Make sure there is no weird punctuation etc in the naming Quote Link to comment
explosionhole Posted March 11, 2023 Share Posted March 11, 2023 (edited) I cannot see any difference in punctuation from the default provided scripts. File permissions are the same. I had to debug it by re-running it while editing the script, but it executes now. Edited March 11, 2023 by explosionhole re-worded Quote Link to comment
kennymc.c Posted March 11, 2023 Share Posted March 11, 2023 On 2/26/2023 at 9:43 PM, kennymc.c said: I noticed that the ACE Editor settings (Ctrl+,) like theme or text size are not saved. As soon as you exit the User Scripts plugin and open it again, the default settings are loaded again. There are also display problems with the Black and White Base Themes. Themes with a vertical menu bar like Azure and Grey are not affected. The problem also affects other plugins that use the ACE editor, like Dynamix File Manager. Could anyone reproduce this? Quote Link to comment
explosionhole Posted March 11, 2023 Share Posted March 11, 2023 this is my `script` syntax: #!/bin/bash #foregroundOnly=true backgroundOnly=true arrayStarted=true #name=blah blah blah #argumentDescription=This is the description of the argument(s) #argumentDefault=defaultArg1 defaultArg2 etc docker exec mariadb sh -c 'exec mysqldump --all-databases -uroot -p"password" | gzip > /mnt/backups/unraid_`date "+%d-%m-%Y"`.sql.gz' find /mnt/user/data/Backups/mariadb/ -type f -mtime +15 | xargs rm Quote Link to comment
House Of Cards Posted March 15, 2023 Share Posted March 15, 2023 I am looking to do some automatic copying and deleting between shares for my media server. Is there any danger just copying using the disk paths directly? Like "cp /mnt/disk1/path/to/source /mnt/disk2/path/to/destination"? The paths would be shares. Or should I use "cp /mnt/user/path/to/source /mnt/user/path/to/destination"? Or does it matter using this plugin? I don't want to mess up permissions or something. Thanks. Quote Link to comment
dayvight Posted March 15, 2023 Share Posted March 15, 2023 I have a problem about 502 bad gateway when i run script or run in backgroud.I tried to reinstall the plugin to no avail. Quote Link to comment
House Of Cards Posted March 20, 2023 Share Posted March 20, 2023 Any chance of adding sort options to the top, like by script name, next run date/time? Quote Link to comment
kennymc.c Posted March 26, 2023 Share Posted March 26, 2023 On 2/26/2023 at 9:43 PM, kennymc.c said: I noticed that the ACE Editor settings (Ctrl+,) like theme or text size are not saved. As soon as you exit the User Scripts plugin and open it again, the default settings are loaded again. There are also display problems with the Black and White Base Themes. Themes with a vertical menu bar like Azure and Grey are not affected. The problem also affects other plugins that use the ACE editor, like Dynamix File Manager. The ACE editor settings appearance bug was recently fixed in Dynamix File Manager but unfortunately these settings cannot be saved permanently. Maybe someone here knows if and how this is possible. Quote Link to comment
nukecat Posted March 26, 2023 Share Posted March 26, 2023 unable to install plugin neither via webui or cli os version:6.12.0-rc2. Installing info via cli: SNAIL ~ # plugin install https://raw.githubusercontent.com/Squidly271/user.scripts/master/plugins/user.scripts.plg plugin: installing: user.scripts.plg Executing hook script: pre_plugin_checks plugin: downloading: user.scripts.plg plugin: downloading: user.scripts.plg ... done Executing hook script: pre_plugin_checks plugin: downloading: user.scripts-2023.03.04-x86_64-1.txz ... done +============================================================================== | Installing new package /boot/config/plugins/user.scripts/user.scripts-2023.03.04-x86_64-1.txz +============================================================================== Verifying package user.scripts-2023.03.04-x86_64-1.txz. Installing package user.scripts-2023.03.04-x86_64-1.txz: PACKAGE DESCRIPTION: Package user.scripts-2023.03.04-x86_64-1.txz installed. plugin: run failed: /usr/bin/php Executing hook script: post_plugin_checks SNAIL ~ # syslog during installation: Mar 27 02:57:32 SNAIL root: plugin: creating: /boot/config/plugins/user.scripts/user.scripts-2023.03.04-x86_64-1.txz - downloading from URL https://raw.githubusercontent.com/Squidly271/user.scripts/master/archive/user.scripts-2023.03.04-x86_64-1.txz Mar 27 02:57:34 SNAIL root: plugin: checking: /boot/config/plugins/user.scripts/user.scripts-2023.03.04-x86_64-1.txz - MD5 Mar 27 02:57:34 SNAIL root: plugin: running: upgradepkg --install-new /boot/config/plugins/user.scripts/user.scripts-2023.03.04-x86_64-1.txz Mar 27 02:57:36 SNAIL root: plugin: running: anonymous diagnostics: snail-diagnostics-20230327-0258.zip Quote Link to comment
Squid Posted March 27, 2023 Author Share Posted March 27, 2023 Try it again. On 6.12 it wouldn't install fresh due to a PHP8 error Quote Link to comment
nukecat Posted March 27, 2023 Share Posted March 27, 2023 5 hours ago, Squid said: Try it again. On 6.12 it wouldn't install fresh due to a PHP8 error Thx,worked! Quote Link to comment
Sakashi Posted March 27, 2023 Share Posted March 27, 2023 (edited) Can you add theme Support for the PopUp window, when i click "run script" ? i have a issue for me: startScript.sh Quote #!/bin/bash echo "Script location: <b>$1</b>" echo "<style> body {background-color: #000000} </style>" echo "<body>" export HOME=$(grep $(whoami) /etc/passwd | cut -d: -f 6) source ${HOME}/.bashrc echo "<font color='red'>Note that closing this window will abort the execution of this script</font>" "$1" "$2" 2>&1 echo "</body>" I use unraid 6.12-rc2. I added "style" and "body" in this script and i can theme now. Maybe you can add theme support for the future versions. I added a picture for impressions. Picture: Spoiler regards Sakashi Edited March 27, 2023 by Sakashi Quote Link to comment
1971camaroguy Posted March 29, 2023 Share Posted March 29, 2023 I have a question, I am not 100% familiar with scripting so someone on another group helped me out with this. It's supposed to look at the trailers folder and compare it to my movies folder for a movie match and if a trailer isn't in that movies folder, and there is a match in the Trailers folder, it will copy it over, otherwise ignore the movie folder and move on. He wrote it assuming the script would be sitting in the same share (Storage-1) as the trailer and movie folder sits in. But I think with this pugin the script is in it's own folder in /boot/config/plugins/user.scripts/scripts I was wondering if someone could help me put the direct paths in this script so I can get it working? Right now the paths of my share and the two folders are structured like this, with Storage-1 being the main share folder. Storage-1 / Trailers Storage-1 / Movies Thanks for the help! Much appriciated #!/usr/bin/bash for trailer in Trailers/*; do echo "Searching for movie for Trailer - '$trailer'" basename=$(basename "$trailer" .mkv) basename=${basename%-trailer} basename=${basename/%.[[:digit:]][[:digit:]][[:digit:]][[:digit:]]/} basename=${basename/% ([[:digit:]][[:digit:]][[:digit:]][[:digit:]])/} basename=${basename/[/\\[} basename=${basename/]/\\]} matches=`find Movies -iname "$basename"\*` if [[ -n "${matches}" ]]; then num=$(echo -n "${matches}" | grep -c '^') if [[ "$num" == "1" ]]; then echo "--> Found match for trailer ${matches}" echo mv "$trailer" "${matches}" else echo "Multiple matches for trailer: ${trailer}" echo "${matches}" fi #else # echo "--> No match found for trailer ${matches}" fi done Quote Link to comment
Squid Posted March 29, 2023 Author Share Posted March 29, 2023 On 3/27/2023 at 3:04 PM, Sakashi said: Maybe you can add theme support for the future versions. Done. The popup window already follows the theme set by the webGUI. IE: it doesn't make any changes to the popup Quote Link to comment
1971camaroguy Posted March 29, 2023 Share Posted March 29, 2023 18 hours ago, 1971camaroguy said: I have a question, I am not 100% familiar with scripting so someone on another group helped me out with this. It's supposed to look at the trailers folder and compare it to my movies folder for a movie match and if a trailer isn't in that movies folder, and there is a match in the Trailers folder, it will copy it over, otherwise ignore the movie folder and move on. He wrote it assuming the script would be sitting in the same share (Storage-1) as the trailer and movie folder sits in. But I think with this pugin the script is in it's own folder in /boot/config/plugins/user.scripts/scripts I was wondering if someone could help me put the direct paths in this script so I can get it working? Right now the paths of my share and the two folders are structured like this, with Storage-1 being the main share folder. Storage-1 / Trailers Storage-1 / Movies Thanks for the help! Much appriciated #!/usr/bin/bash for trailer in Trailers/*; do echo "Searching for movie for Trailer - '$trailer'" basename=$(basename "$trailer" .mkv) basename=${basename%-trailer} basename=${basename/%.[[:digit:]][[:digit:]][[:digit:]][[:digit:]]/} basename=${basename/% ([[:digit:]][[:digit:]][[:digit:]][[:digit:]])/} basename=${basename/[/\\[} basename=${basename/]/\\]} matches=`find Movies -iname "$basename"\*` if [[ -n "${matches}" ]]; then num=$(echo -n "${matches}" | grep -c '^') if [[ "$num" == "1" ]]; then echo "--> Found match for trailer ${matches}" echo mv "$trailer" "${matches}" else echo "Multiple matches for trailer: ${trailer}" echo "${matches}" fi #else # echo "--> No match found for trailer ${matches}" fi done I got my issue sorted out, moving and matching trailers as expected now 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.