comet424 Posted January 20, 2021 Share Posted January 20, 2021 (edited) how do you organize the Scripts i tried renaming so the Scripts would resort alphabetical as i got 20 scripts i trying to clean up but i want to sort them like group them (computer1) does that script (computer1) does this script (computer 2 does this script) (computer 3) or is there a text file named "order" that shows the order of scripts so i can manually move them around to organize the scripts properly group them and how do you get it when you Change the user script name.. that it will change the actual File name too.. it doesnt do that.. it keeps the old script name also be nice to sort by Custom, Daily, Monthly and also sort by Custom + File name Daily + Filename Monthy + Filename or have Breaks ------------------- between sets Daily script 1 script 2 ------------------------ Monthly script 3 script 4 -------------------------------- Daily script 5 script 6 Edited January 20, 2021 by comet424 2 Quote Link to comment
comet424 Posted January 20, 2021 Share Posted January 20, 2021 also is the dangling images script id is depreciated? it doesnt work .. i tried different wayts #docker rmi $(docker images --quiet --filter "dangling=true") #docker rmi $(docker images -q -f dangling=true) docker rmi $(docker images -f dangling=true -q) if you run the command line docker rmi --help there is no -q -f or dangling as options so is that script depreciated Quote Link to comment
Acu Posted February 5, 2021 Share Posted February 5, 2021 Hi i have a problem with the plugin user script. I used diacritics for some names. And now I can't remove these scripts and I can't set the cron function. Even after reinstallation, these scripts always appear there and cannot be deleted. Is it possible to reset this plugin to factory settings? Quote Link to comment
Acu Posted February 5, 2021 Share Posted February 5, 2021 14 minutes ago, Acu said: Hi i have a problem with the plugin user script. I used diacritics for some names. And now I can't remove these scripts and I can't set the cron function. Even after reinstallation, these scripts always appear there and cannot be deleted. Is it possible to reset this plugin to factory settings? So I've figured it out just to rename the folder on the flash drive. user.scripts.old I couldn't delete it, but after renaming all the scripts disappeared. Quote Link to comment
Squid Posted February 5, 2021 Author Share Posted February 5, 2021 You want to rename the folders within /config/plugins/user.scripts/scripts 1 Quote Link to comment
TexasUnraid Posted February 10, 2021 Share Posted February 10, 2021 Does anyone know of a way to setup a button in the GUI to 1-click run a script? Custom Tabs does not seem to support this but something along those lines is what I am looking for. Looking for a way to easily switch between power saving mode (which the server stays in 95% of the time) and performance (only when having it render or do something intensive). Also be nice for some other uses as well such as a sync script I have, or snapshots etc Quote Link to comment
Energen Posted February 11, 2021 Share Posted February 11, 2021 On 2/10/2021 at 7:51 AM, TexasUnraid said: Does anyone know of a way to setup a button in the GUI to 1-click run a script? Custom Tabs does not seem to support this but something along those lines is what I am looking for. Looking for a way to easily switch between power saving mode (which the server stays in 95% of the time) and performance (only when having it render or do something intensive). Also be nice for some other uses as well such as a sync script I have, or snapshots etc Don't know if this is a starting point but you'd have to 1) implement your button into the GUI initially for testing, and 2) make it so that it is recreated upon reboot... then you may be able to get some ideas here https://stackoverflow.com/questions/44443164/execute-a-shell-script-from-html Quote Link to comment
TexasUnraid Posted February 11, 2021 Share Posted February 11, 2021 (edited) 10 minutes ago, Energen said: Don't know if this is a starting point but you'd have to 1) implement your button into the GUI initially for testing, and 2) make it so that it is recreated upon reboot... then you may be able to get some ideas here https://stackoverflow.com/questions/44443164/execute-a-shell-script-from-html Thanks, I was looking for something more integrated into unraid. Customtabs would work great if it had the option to run a script / command. Don't really want to do anything custom to the OS unless I have to. I was hoping there was a plug-in that could do this that I had not heard of. Kinda surprised that nothing exsists to be honest, seems like something someone would of wanted in all these years. Edited February 11, 2021 by TexasUnraid Quote Link to comment
Mogo Posted February 13, 2021 Share Posted February 13, 2021 Hi, I'm trying to add a script, however I cannot create the folder in config/plugins/user.scripts/scripts. I get a "Destination Folder Access Denied" error. Any ideas on how to fix this? Also just a coding question. I'm trying to write a python script to list directories using pycharm in a docker. If i run the following commands these are the outputs: - "pwd" returns "/home/nobody/PychamProjects/test" (above command works) - "ls -l ../mnt/cache/appdata" returns "No such file or directory" (what should be the correct path? typing that command in the unraid terminal gives a directory listing) Quote Link to comment
Energen Posted February 13, 2021 Share Posted February 13, 2021 1 hour ago, Mogo said: Hi, I'm trying to add a script, however I cannot create the folder in config/plugins/user.scripts/scripts. I get a "Destination Folder Access Denied" error. Any ideas on how to fix this? Also just a coding question. I'm trying to write a python script to list directories using pycharm in a docker. If i run the following commands these are the outputs: - "pwd" returns "/home/nobody/PychamProjects/test" (above command works) - "ls -l ../mnt/cache/appdata" returns "No such file or directory" (what should be the correct path? typing that command in the unraid terminal gives a directory listing) Docker containers are separate from the host OS meaning that a docker container has no knowledge of /mnt/cache/appdata -- it does not exist because it cannot access Unraid's filesystem. Quote Link to comment
Squid Posted February 14, 2021 Author Share Posted February 14, 2021 8 hours ago, Mogo said: Hi, I'm trying to add a script, however I cannot create the folder in config/plugins/user.scripts/scripts. I get a "Destination Folder Access Denied" error. Any ideas on how to fix this? Where are you seeing this? Quote Link to comment
Mogo Posted February 14, 2021 Share Posted February 14, 2021 (edited) It was on the windows machine when you browse using file explorer to create a folder on the unraid system. I figured out what the issue was. For some reason the smb security settings was set to secure (for the usb flash drive) which prevents write access. I changed it to public and it allows me to create the folder now. I guess i have to live with that warning beside the usb flash drive saying to change it. Edited February 14, 2021 by Mogo Quote Link to comment
Squid Posted February 15, 2021 Author Share Posted February 15, 2021 On 2/10/2021 at 7:51 AM, TexasUnraid said: Does anyone know of a way to setup a button in the GUI to 1-click run a script? Custom Tabs does not seem to support this but something along those lines is what I am looking for. Looking for a way to easily switch between power saving mode (which the server stays in 95% of the time) and performance (only when having it render or do something intensive). Also be nice for some other uses as well such as a sync script I have, or snapshots etc You would need to do this: Create the file called /usr/local/emhttp/plugins/myscript/script.page Menu="Tasks:80" Name="My Script" Type="xmenu" Tabs="true" Code="e942" You can move where the tab is located by adjusting the number within "Menu" as per the tab numbering here: https://forums.unraid.net/topic/57109-plugin-custom-tab/ Create another file called /usr/local/emhttp/plugins/myscript/myscript.page Menu="script" --- <? echo "<h1>Running script</h1><br><br>"; passthru("/bin/bash /boot/myscript.sh"); ?> Change the bash command appropriately within "passthru" Note: The page will keep loading while the script executes. If you're planning on doing something like starting a long running script (rsync?) by doing this, then the script that you call has to start another script via the "AT" command in bash. The screen does not update as the script executes, but will only be updated once the script is finished. If after starting the script you want the GUI to go back to where ever you were at prior to clicking the custom tab, then add to the second file <script>history.back();</script> ALL of these files need to be saved with standard linux line endings (use Notepad++) Copy the files to the folder in RAM via the userscripts plugin (or go file) at first boot 1 Quote Link to comment
TexasUnraid Posted February 17, 2021 Share Posted February 17, 2021 (edited) On 2/15/2021 at 7:17 AM, Squid said: You would need to do this: Create the file called /usr/local/emhttp/plugins/myscript/script.page Menu="Tasks:80" Name="My Script" Type="xmenu" Tabs="true" Code="e942" You can move where the tab is located by adjusting the number within "Menu" as per the tab numbering here: https://forums.unraid.net/topic/57109-plugin-custom-tab/ Create another file called /usr/local/emhttp/plugins/myscript/myscript.page Menu="script" --- <? echo "<h1>Running script</h1><br><br>"; passthru("/bin/bash /boot/myscript.sh"); ?> Change the bash command appropriately within "passthru" Note: The page will keep loading while the script executes. If you're planning on doing something like starting a long running script (rsync?) by doing this, then the script that you call has to start another script via the "AT" command in bash. The screen does not update as the script executes, but will only be updated once the script is finished. If after starting the script you want the GUI to go back to where ever you were at prior to clicking the custom tab, then add to the second file <script>history.back();</script> ALL of these files need to be saved with standard linux line endings (use Notepad++) Copy the files to the folder in RAM via the userscripts plugin (or go file) at first boot Perfect! That sounds like just what I was looking for. I do have an rsync script I was wanting to run like this, I will add the command you listed to see if that works without interfering with the GUI. Is it possible to run it the same way user scripts works with the "run in background" option? Aka, it will keep the log in user scripts for later reference? Or possibly open the script in a new window with the output visible like running from user scripts? I can make it work without logging, just reduces the uses a bit. Having power outages right now due to weather so the server is shut down but will give it a try when I turn it back on. Edited February 17, 2021 by TexasUnraid Quote Link to comment
TexasUnraid Posted February 22, 2021 Share Posted February 22, 2021 (edited) On 2/15/2021 at 7:17 AM, Squid said: You would need to do this: Create the file called /usr/local/emhttp/plugins/myscript/script.page Menu="Tasks:80" Name="My Script" Type="xmenu" Tabs="true" Code="e942" You can move where the tab is located by adjusting the number within "Menu" as per the tab numbering here: https://forums.unraid.net/topic/57109-plugin-custom-tab/ Create another file called /usr/local/emhttp/plugins/myscript/myscript.page Menu="script" --- <? echo "<h1>Running script</h1><br><br>"; passthru("/bin/bash /boot/myscript.sh"); ?> Change the bash command appropriately within "passthru" Note: The page will keep loading while the script executes. If you're planning on doing something like starting a long running script (rsync?) by doing this, then the script that you call has to start another script via the "AT" command in bash. The screen does not update as the script executes, but will only be updated once the script is finished. If after starting the script you want the GUI to go back to where ever you were at prior to clicking the custom tab, then add to the second file <script>history.back();</script> ALL of these files need to be saved with standard linux line endings (use Notepad++) Copy the files to the folder in RAM via the userscripts plugin (or go file) at first boot Ok, finally got the server back up and running so setting this up. I am FAR from an expert but doesn't /usr/local/emhttp/plugins/ get wiped on reboot? I thought the only persistent folder was /boot? could I put the files in /boot/config/plugins instead? Partly asking about this situation but also for future information. Edited February 22, 2021 by TexasUnraid Quote Link to comment
Squid Posted February 22, 2021 Author Share Posted February 22, 2021 29 minutes ago, TexasUnraid said: could I put the files in /boot/config/plugins instead? Won't work 29 minutes ago, TexasUnraid said: I am FAR from an expert but doesn't /usr/local/emhttp/plugins/ get wiped on reboot? Yes On 2/15/2021 at 8:17 AM, Squid said: Copy the files to the folder in RAM via the userscripts plugin (or go file) at first boot 1 Quote Link to comment
TexasUnraid Posted February 22, 2021 Share Posted February 22, 2021 22 minutes ago, Squid said: Won't work Yes Ok, was not sure if there was an easier way. Is it possible to put a sleep command into the .page file? I would like for it to pause for ~2 seconds after running so I can see what state the CPU was switched to. I tried putting the sleep a few places but it caused an error. Otherwise it seems to be working great! Quote Link to comment
TexasUnraid Posted February 22, 2021 Share Posted February 22, 2021 Just in case someone finds this on google later, figured I would toss up my script for changing the CPU governer using the above settings. I store the script.page files in a sub-folder of the user-script to keep things tidy. /boot/config/plugins/user.scripts/scripts/Power\ Governer\ switcher/cpu-power-switch then I have a script that runs at array start that copies the files to the right location cp -r /boot/config/plugins/user.scripts/scripts/Power\ Governer\ switcher/cpu-power-switch /usr/local/emhttp/plugins/ The script itself is really simple, you need Tips & tweaks plugin installed for it to work #!/bin/bash #description=This script switches the CPU Governer between Powersave and Performance (schedutil) #backgroundOnly= #arrayStarted= #noParity= #argumentDescription= #argumentDefault= #set -x GOVERNER=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) if [ "$GOVERNER" = powersave ] then /usr/local/sbin/rc.tweaks set_governor schedutil echo "CPU is being changed to Performance Mode" else /usr/local/sbin/rc.tweaks set_governor powersave echo "CPU is being Changed to PowerSave Mode" fi echo "The CPU Governer is now set to $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)" /usr/local/emhttp/webGui/scripts/notify -i normal -e "New CPU Governer" -s "The new CPU governer is set to" -d "$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)" It is working perfect, I can now change the governer with a single button. It saves 20-40w of power easily, much more under higher loads but also allows for full performance if I need it. Also gives me ideas for other uses of this method. Thanks for the help Squid! Quote Link to comment
TexasUnraid Posted February 22, 2021 Share Posted February 22, 2021 I was working on the rsync script now and was curious, where are the background logs for user scripts stored? Would it be possible to send the output from the script directly into the log file to make viewing it later easy? The syntax for this would be apprishiated as well, I always get confused by the > vs >> and it seems a half dozen other methods of sending the output to another place. Quote Link to comment
questionbot Posted March 4, 2021 Share Posted March 4, 2021 How dose the "custom" tab work in schedule? Like how would I make a script run every hour for example... Also how would I add code to the script to make sure is is not running when it tries to execute? if pgrep -x "rclone_Sync.sh" > /dev/null then #echo "Running" rclone sync /sourceDir remote: else #echo "Stopped" fi Quote Link to comment
wgstarks Posted March 4, 2021 Share Posted March 4, 2021 2 hours ago, questionbot said: How dose the "custom" tab work in schedule? Like how would I make a script run every hour for example... It’s a cron schedule. 0 * * * * Would run the script at the top of every hour. Quote Link to comment
questionbot Posted March 4, 2021 Share Posted March 4, 2021 (edited) 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 Edited March 4, 2021 by questionbot Quote Link to comment
tschinz Posted March 11, 2021 Share Posted March 11, 2021 Hello guys, i've tried searching within this huge thread but I couldn't find a working answer. I want to call from one user script another user script. For this the following command was used. echo "/boot/config/plugins/user.scripts/scripts/backup_onedrive/script" | at now But I got following error sh: line 18: /boot/config/plugins/user.scripts/scripts/backup_onedrive/script: Permission denied I tried via the console to sudo chmod +x /boot/config/plugins/user.scripts/scripts/backup_onedrive/script But the execute x flag is never applied. Any tips or hints? Thanks in advance tschinz Quote Link to comment
Marcel40625 Posted March 11, 2021 Share Posted March 11, 2021 (edited) Hey there, i would like to know how i can mail the whole output of rsync -av --delete --ignore-errors -e as notification thanks in advance Edited March 11, 2021 by Marcel40625 Quote Link to comment
ICDeadPpl Posted March 11, 2021 Share Posted March 11, 2021 53 minutes ago, tschinz said: Hello guys, i've tried searching within this huge thread but I couldn't find a working answer. I want to call from one user script another user script. For this the following command was used. echo "/boot/config/plugins/user.scripts/scripts/backup_onedrive/script" | at now But I got following error sh: line 18: /boot/config/plugins/user.scripts/scripts/backup_onedrive/script: Permission denied I tried via the console to sudo chmod +x /boot/config/plugins/user.scripts/scripts/backup_onedrive/script But the execute x flag is never applied. Any tips or hints? Thanks in advance tschinz Put 'bash' in front of the command. Like 'bash /boot/config/plugins/user.scripts/scripts/backup_onedrive/script' 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.