July 10Jul 10 11 hours ago, Kurotaku said:pidof isn't reliable with scripts because basename might just return names like bash or sh.You could do sth rly simple like that (if you don't mind skipping syncs when another sync is running):#!/bin/bash lock_file="/tmp/scriptname.lock"; if [ -f "${lock_file}" ]; then echo "Script is already running"; exit 1; fitouch "${lock_file}"; echo "Starting rsync process..."; rm -f "${lock_file}";Hey thanks for that example, i'll try that out! I for sure do not wanting it to run twice. What happens is the script catches up to itself due to large files and then it starts deleting the file in progress by the other process. My only question is what happens when I click the abort script, do I need to go delete the lock file manually?
July 10Jul 10 17 minutes ago, nerbonne said:Hey thanks for that example, i'll try that out! I for sure do not wanting it to run twice. What happens is the script catches up to itself due to large files and then it starts deleting the file in progress by the other process.My only question is what happens when I click the abort script, do I need to go delete the lock file manually?With abort it would not delete the file, you would need to delete the file first manually, or create another script which deletes it.As for me I personally always just use python scripts.Means the bash script calling py /mnt/cache/scripts/script.py for me, bcs Its much better syntax and you can do much more with python, like checks if the programm already running etc.Just ask Claude/ChatGPT or Gemini to create scripts for stuff like that, thats what I do on daily basis.As I'm currently working on a big and maybe last major release version of User Scripts Enhanced, I will may in the future create a Standalone version for User Scripts Enhanced which allows then for me to implement stuff like this, that you can't start the same script at the same time by default. But that will take a lot time, and first my other 2 new Plugins must be finished :) Edited July 10Jul 10 by Kurotaku
July 27Jul 27 I have a user script to backup my movies, etc from one unraid server to another using rsync. How can I include the available disk space of the destination server in the log? I have attached a log file so that someone could show me how to interpret it. log.zip
July 29Jul 29 9 hours ago, Steviewunda said:Anybody?ChatGPT can typically easily help with those kinds of issues.
August 1Aug 1 is there something i need to add i cant shut down a computer in user scripts.. i can wake it up rysnc but when it comes to shut down it doesnt shut down... i can do it in the terminal using ip address but in the user script doesnt workserver="192.168.0.4" #ssh -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa root@$server '/sbin/poweroff' #ssh -o StrictHostKeyChecking=no root@$server '/sbin/poweroff' ssh root@$server '/sbin/poweroff'none of them work in the user script .. but if i replace it with ip address in the terminal no issuesis there something i missing in the user scripts?
August 1Aug 1 2 hours ago, comet424 said:is there something i need to add i cant shut down a computer in user scripts.. i can wake it up rysnc but when it comes to shut down it doesnt shut down... i can do it in the terminal using ip address but in the user script doesnt workserver="192.168.0.4" #ssh -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa root@$server '/sbin/poweroff' #ssh -o StrictHostKeyChecking=no root@$server '/sbin/poweroff' ssh root@$server '/sbin/poweroff'none of them work in the user script .. but if i replace it with ip address in the terminal no issuesis there something i missing in the user scripts?I don't know how to fix this, but if you need a bypass solution for that, install the python plugin and create a python script which is called via user scripts. That way it will definitly work.
August 1Aug 1 @Kurotaku ah ok so its some kind of glitch? is there a way to show log files for yai not sure how to make a script for it but the way i been doing it for like 8 years was just ssh [email protected] '/sbin/poweroff' etcbut i recently last few days been updating my scripts so i can mod them a bit adding server and i can just change the ip address as i have a few servers.. and i copy and paste the script and just change the ip address.. but i noticed this bug it doesnt like itdo you think its an unraid problem? or how user scripts works? i though user scripts was python scripts
August 2Aug 2 1 hour ago, comet424 said:@Kurotaku ah ok so its some kind of glitch?is there a way to show log files for yai not sure how to make a script for itbut the way i been doing it for like 8 years was just ssh [email protected] '/sbin/poweroff'etcbut i recently last few days been updating my scripts so i can mod them a bit adding server and i can just change the ip addressas i have a few servers.. and i copy and paste the script and just change the ip address.. but i noticed this bug it doesnt like itdo you think its an unraid problem? or how user scripts works? i though user scripts was python scriptsI can recommend you to just get a Claude Account (or ChatGPT/Gemini)I personally use Claude for every big project only, even tho the limitations are extreme (after a couple of prompts you need to wait some hours)But claude is extremly good compared to all others I've used.User Scripts is bash, you will need to install python plugin to be able to use python scripts, my guess for you problem is that the bash is in a different environment.I personally have nearly every script only in python as its much easier to read/maintain and debug for me, I have them all on /mnt/cache/scripts/That way I can also easily update/modify them on a friends server and mine without going over the UI of Unraid which is a bit annoying to use.
August 2Aug 2 @Kurotaku oh so you didnt write the user scripts since you said you dont know how to fix ..ok ill look into the python stuff.. and isnt bash python? isnt the scripts in user scripts python least thats what i though they were
August 2Aug 2 4 hours ago, comet424 said:and isnt bash python? isnt the scripts in user scripts python least thats what i though they wereshort, nope.
August 2Aug 2 @alturismo oh ok whats the difference? is like bash is equal to dos batch files and python is just programming?
August 2Aug 2 9 minutes ago, comet424 said:@alturismo oh ok whats the difference? is like bash is equal to dos batch files and python is just programming?Bash is a shell scripting language that's mainly used to automate commands and interact with the operating system. Basically the Linux equivalent of Windows batch files.Python is a programming language. You can write everything from small scripts to web servers, desktop applications, AI tools, and much more.User Scripts in Unraid executes Bash by default. If you want to run Python, you need to install Python separately and call your .py script explicitly.I've sent you a solution to your problem in Discord yesterday.
August 2Aug 2 @Kurotaku ah ok ya so dos/windows batch programs i used to write in in the 80s and 90s and early 2000slearn something new everyday... and i never got the message on discord.. least i dont have any notifications... ill take a lookand you were saying the user scripts executes in a different enviroment is that like you execute it in this bubble but when it runs it runs in a new bubble and thats why like the ssh cant can read variables for ssh right as the variable is in bubble 1 and the ssh is running in bubble 2.. baasicllyand ill look on discord for your message now
August 2Aug 2 @Kurotaku never saw a DM from ya and i looked in multiple unraid topics didnt see message from ya.. discord doesnt seem to show notificaiton you wrote.. i guess unless your in it and catch it fast enough you never know someone ever messaged youand searching Kurotaku shows up nothing so sorry i missed your message on there Edited August 2Aug 2 by comet424
August 3Aug 3 Is there any way to fix the log windows so that they show in dark mode? The native unraid windows like terminal and syslog show in dark mode, but the log windows for user scripts don't and it's blinding. Is that something that can be fixed?
August 3Aug 3 2 minutes ago, nerbonne said:Is there any way to fix the log windows so that they show in dark mode? The native unraid windows like terminal and syslog show in dark mode, but the log windows for user scripts don't and it's blinding. Is that something that can be fixed?The easiest solution would be install Stylus extension.Create a Stylesheet for: http://SERVER-IP/logging.htm body { background: #000; color: #fff;}
August 5Aug 5 Is there any way we could get the scripts list sorted alphabetically? Edited August 5Aug 5 by Led57
August 5Aug 5 14 hours ago, Led57 said:Is there any way we could get the scripts list sorted alphabetically?They are alphabetically, with one exception.When you create sth ABC, rename it then to XYZ it will still be in the folder ABC and sorted as well like this.You can rearange them in categories with User Scripts Enhanced.
Yesterday at 05:19 AM1 day Hi all,when I click on install for User Scripts I get the following prompt:Install Plugin - Finished Downloading plugin plugin: YfQmUk04Khw6hp31ZUib8XuigmgyVBJ9d_Yr4teGWFxKDxz6EwUbGeHZ4kqe9u6oM_WN6wH6JK3kD1fzw_PVJzgVfAhmSQhXxmFM5cANyNbglFovXixPLkcKLAUafcNY3wZt8sydLnVQVUCyjEBC-uLKQyZK6t8 is not a plg file Plugin installedanything i should be worries about? Is your App ok?Thanks for checking.
Yesterday at 11:32 AM1 day 6 hours ago, iPat said:Hi all,when I click on install for User Scripts I get the following prompt:Install Plugin - Finished Downloading plugin plugin: YfQmUk04Khw6hp31ZUib8XuigmgyVBJ9d_Yr4teGWFxKDxz6EwUbGeHZ4kqe9u6oM_WN6wH6JK3kD1fzw_PVJzgVfAhmSQhXxmFM5cANyNbglFovXixPLkcKLAUafcNY3wZt8sydLnVQVUCyjEBC-uLKQyZK6t8 is not a plg file Plugin installedanything i should be worries about? Is your App ok?Thanks for checking.download is working again, thanks.
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.