kizer Posted January 8 Share Posted January 8 On 1/7/2024 at 11:49 AM, House Of Cards said: Love this plugin.... Thanks @Squid for all your ongoing efforts...  Maybe a script aficionado could help me modify this script? I do some overly tedious scheduling of media content from a location with everything in it, to a location with "active" content. This makes my media server constantly cycle in/out content so it's interactive. Works great, but I have a special case where I don't want to schedule 80 scripts...  Don't laugh, but it's Looney Tunes, with like 40 seasons. 😆  Here is a basic script I would use for content in...  # CREATE NECESSARY SERIES DIRECTORIES mkdir -p /mnt/user/"Television- Media Server"/"Family Guy (1999)" # RECREATE MISSING SERIES METADATA cp /mnt/user/"Television- All Media"/"Family Guy (1999)"/* /mnt/user/"Television- Media Server"/"Family Guy (1999)"/ # ADD CONTENT TO PRODUCTION SERVER cp -R /mnt/user/"Television- All Media"/"Family Guy (1999)"/"Season 01" /mnt/user/"Television- Media Server"/"Family Guy (1999)"  I need to modify this script to create a VARIABLE between "1929" and "1969", and substitute that number for the season number in the copying commands. All the documentation I found on this is confusing, so any help would be greatly appreciated.  Don't know if this will help you much, but its an idea. https://unix.stackexchange.com/questions/468500/creating-directories-with-sequential-numbering Quote Link to comment
ilovetea Posted January 9 Share Posted January 9 Hi - Not sure if this is the right place to post this but I need to be able to run a script which stops my plex docker at say 3am in the morning and then restarts it straight away. The reason I want to do this is that for some reason Plex will be using 100% cpu on a single core for no reason and im currently manually restarting the docker and CPU usage drops. Â Is this possible using this plugin and if so would appreciate some help in what I need to include within the script (I'm a novice and have no idea where to start) Quote Link to comment
frodr Posted January 10 Share Posted January 10 I can't edit scripts. Holding the pointer of the cog, edit scrips is there. But nothing happens when pushing the button. kjell-diagnostics-20240110-1237.zip Quote Link to comment
frodr Posted January 10 Share Posted January 10 8 hours ago, frodr said: I can't edit scripts. Holding the pointer of the cog, edit scrips is there. But nothing happens when pushing the button. kjell-diagnostics-20240110-1237.zip 235.94 kB · 0 downloads  I was just Safari having a hick up. Strange, because it worked on the other server. Quote Link to comment
Bob Cadenza Posted January 21 Share Posted January 21 Why doesn't python output show up in logs? To do a test, I made a simple python program that just prints a number out every 5 seconds. But when I run in userscripts, nothing is printed out. What is going on? Â Â Quote Link to comment
House Of Cards Posted January 22 Share Posted January 22 On 1/8/2024 at 5:57 PM, kizer said:  Don't know if this will help you much, but its an idea. https://unix.stackexchange.com/questions/468500/creating-directories-with-sequential-numbering  Thanks, but my need was much simpler. In the first line of the script I put the following which generates a random number between the applicable season range... # GENERATE RANDOM SEASON NUMBER season=$((RANDOM % (1969 - 1929 + 1) + 1929))  Then I modify the copy line to read... # ADD CONTENT TO PRODUCTION SERVER cp -R /mnt/user/"Television- All Media"/"Looney Tunes (1929)"/"Season $season" /mnt/user/"Television- Media Server"/"Looney Tunes (1929)"  Been working like a charm. Each week it adds a different random season. There are quite a few use cases for this, but because there are like 40 seasons of this show, I can change it each week (new in Monday, old out Sunday) so you get a random classic cartoon in your television shuffle. Quote Link to comment
saber1 Posted January 25 Share Posted January 25 On 1/10/2024 at 9:15 PM, frodr said: I was just Safari having a hick up. Strange, because it worked on the other server. Same here with two different servers. But if i try another browser (Opera) it works. So it must be an issue on Safari's side. Quote Link to comment
StabbyMeowkins Posted February 2 Share Posted February 2 (edited) I'm currently having issues with this plugin that I can not seem to find out whatsoever. I'm making a script, set a schedule, clicking apply, nothing happens. I've made a script to restart a game docker every other hour on CA User Scripts. I've set the Cron schedule to "0 */2 * * *" also. Pressing apply does not start the schedule or do anything. I've tried uninstalling the plugin and reinstalling. I've tried on four separate browsers that do not have any form of modification to them at all nor adblockers. (Chrome, Brave, Opera and Edge). I am using the webGUI for reference. I'm on the most recent stable release of UNRAID, also.  The above is script and the information. I can run script and tell it to 'run in background' and it works. But as soon as I leave the page (Clicking Apply then Done), it does not save the custom scheduling at all or anything. I've tried clicking apply, and do not get the notification that others get. Mind you this is the first time I've ever made a script in this Plugin because I hadn't needed to otherwise, so I've never just 'had it work' before in the past and all of a sudden it don't work. Here is a picture of someone sending me their view of what happens when they add it. I do not get this at all. It just straight up doesn't work. So I am at a loss. Any help is appreciated or alternatives. Edited February 3 by StabbyMeowkins Quote Link to comment
StabbyMeowkins Posted February 3 Share Posted February 3 The above issue On 2/2/2024 at 3:19 PM, StabbyMeowkins said: I'm currently having issues with this plugin that I can not seem to find out whatsoever. I'm making a script, set a schedule, clicking apply, nothing happens. I've made a script to restart a game docker every other hour on CA User Scripts. I've set the Cron schedule to "0 */2 * * *" also. Pressing apply does not start the schedule or do anything. I've tried uninstalling the plugin and reinstalling. I've tried on four separate browsers that do not have any form of modification to them at all nor adblockers. (Chrome, Brave, Opera and Edge). I am using the webGUI for reference. I'm on the most recent stable release of UNRAID, also.  The above is script and the information. I can run script and tell it to 'run in background' and it works. But as soon as I leave the page (Clicking Apply then Done), it does not save the custom scheduling at all or anything. I've tried clicking apply, and do not get the notification that others get. Mind you this is the first time I've ever made a script in this Plugin because I hadn't needed to otherwise, so I've never just 'had it work' before in the past and all of a sudden it don't work. Here is a picture of someone sending me their view of what happens when they add it. I do not get this at all. It just straight up doesn't work. So I am at a loss. Any help is appreciated or alternatives. The above issue was fixed. There was an issue with a script that was made on accident prior to this issue, that broke the entire ability to use the plugin in general.  Naming the script with the $ sign, completely disabled the ability to use the apply command in the menu, not allowing you to apply the schedule. I had to manually delete the script folder to remove it, before it would work again. Not sure what caused the naming of the script to cause the entire menu to break and refusing the webGUI to work correctly on that page. I was informed to make my post here, as to possibly prevent a miss-type like this from causing this kind of issue. (I could not manually delete the script named with the $ in it either, like I could with other scripts.) Shout out to @Kilrah and @DiscoverIt for helping me find the solution to this problem. Quote Link to comment
sir_storealot Posted February 4 Share Posted February 4 On 1/9/2024 at 9:05 AM, ilovetea said: Hi - Not sure if this is the right place to post this but I need to be able to run a script which stops my plex docker at say 3am in the morning and then restarts it straight away. The reason I want to do this is that for some reason Plex will be using 100% cpu on a single core for no reason and im currently manually restarting the docker and CPU usage drops. Â Is this possible using this plugin and if so would appreciate some help in what I need to include within the script (I'm a novice and have no idea where to start) Hi, not sure if you still need help, but try running: docker restart plex ...in the root shell window in unraid. If this works, add it to a script, and you're done. 1 Quote Link to comment
aerobrain Posted February 5 Share Posted February 5 I can see from this thread that the plugin has been around a long time. But I'm new to UnRAID (set up a couple of months ago), but just got round to trying to use this. Just want to say a big thanks to the dev, such a simple (from and end user point of view, no idea how complex the backend is) but effective tool!  Donation of thanks sent 🙂 Quote Link to comment
Unraidmule Posted February 9 Share Posted February 9 I am running rclone in the background and I think this script is writing GBs of log files on the SSD cache, does anyone how to to confirm this? I can't even locate where this plugin stores the logs. Quote Link to comment
Kilrah Posted February 9 Share Posted February 9 1 hour ago, Unraidmule said: I can't even locate where this plugin stores the logs. /tmp/user.scripts, i.e. in RAM. Quote Link to comment
Unraidmule Posted February 9 Share Posted February 9  35 minutes ago, Kilrah said: /tmp/user.scripts, i.e. in RAM.  Thanks for the reply. Weird since running the rclone script GBs of data is slowly getting written to the cache with nothing else new running to cause the issue.  rclone is writing data directly to the array skipping cache. So I am confused.  I will try looking at that folder again. When I checked I couldn’t access any logs will it be in the running folder? Quote Link to comment
Kilrah Posted February 9 Share Posted February 9 running while running logically (haven't checked), finished afterwards  Quote Link to comment
Fellini70 Posted February 13 Share Posted February 13 I'm currently having an issue where I am unable to see the "logs" button in the web gui. Â I've searched the forum and can see example images where the logs button should be, but for some reason I can't see it. Â Â Get the same result in Chrome and Safari. Plugin is up to date and I'm on Unraid 6.12.6 Â I am new to unraid, so might be making a simple mistake. Any help greatly appreciated. Quote Link to comment
SimonF Posted February 13 Share Posted February 13 10 minutes ago, Fellini70 said: I'm currently having an issue where I am unable to see the "logs" button in the web gui. Â I've searched the forum and can see example images where the logs button should be, but for some reason I can't see it. Â Â Get the same result in Chrome and Safari. Plugin is up to date and I'm on Unraid 6.12.6 Â I am new to unraid, so might be making a simple mistake. Any help greatly appreciated. Have you ran the scripts in background? No schedule so they are not running. Quote Link to comment
Fellini70 Posted February 13 Share Posted February 13 26 minutes ago, SimonF said: Have you ran the scripts in background? No schedule so they are not running. Â Ah ok. I ran the scripts using the "run now" option as a test, before setting up a schedule and I wanted to check the log from that. I'll set it up to run as a schedule and then see if that gives me the log buttons. Thank you. Quote Link to comment
itimpi Posted February 13 Share Posted February 13 2 hours ago, Fellini70 said: I ran the scripts using the "run now" option as a test, I assume you mean the "Run Script" option to run it in the foreground?  If so the log is the contents (if any) of the window that then opens. If nothing appears there you should not expect anything to appear in the log. Quote Link to comment
de-sascha Posted February 14 Share Posted February 14 Hi. I am looking for the option only run a script @reboot. To set specific values. How does this work? Quote Link to comment
luca7 Posted February 23 Share Posted February 23 (edited) Hello, Â I've implemented user scripts in Unraid to automate folder synchronization with Rclone according to a custom schedule. The scripts work effectively, syncing in the background as intended. However, this success comes at a cost: my internet connection, which has limited bandwidth, becomes virtually unusable during sync operations. Â To address this, I attempted to create additional scripts to terminate the Rclone sync at scheduled intervals, aiming to restrict internet downtime to nighttime hours. I used the commands kill $(ps aux | grep '[r]clone' | awk '{print $2}') Â and killall -9 rclone both of which execute successfully in the console but fail to work when executed via user scripts. The challenge arises because the process ID (PID) of Rclone changes with each execution, rendering other methods ineffective. Â I'm seeking advice on how to dynamically terminate a background process, initiated by a user script, using another scheduled user script. Any insights or solutions to this problem would be greatly appreciated. Â Thank you. Â EDIT: Solved by using this really simple but effective rclone flag: --max-duration=TIME For me "4h" marks was the sweet spot. Hope to help someone else in here! Edited February 26 by luca7 Quote Link to comment
hawihoney Posted February 26 Share Posted February 26 (edited) May I issue another feature request here?  Please add a button "Delete all log files" at the bottom of the User Scripts page - beside "Add script" etc  If hit, this would delete all logs of user scripts and - if needed - would refresh that page.  Why? If you have more than 1-3 User Scripts, possibly over 40 like me, it's sometimes neccessary to see what script did run recently.  Thanks for listening.  Edited February 26 by hawihoney 1 Quote Link to comment
alturismo Posted February 26 Share Posted February 26 59 minutes ago, hawihoney said: it's sometimes neccessary to see what script did run recently. may add another script like, will sort the last finished actions ...  -ltr will change from old > new root@AlsServerII:~# ls -lt /tmp/user.scripts/finished/ total 40 -rw-r--r-- 1 root root 8 Feb 26 07:09 CF_DNS_Updater -rw-r--r-- 1 root root 8 Feb 26 07:09 Fan_Control_CPU -rw-r--r-- 1 root root 8 Feb 26 07:08 Fan_Control_HDD -rw-r--r-- 1 root root 8 Feb 26 07:00 Avidemux_TVH_Trigger -rw-r--r-- 1 root root 8 Feb 26 07:00 Calibre_Web_Import -rw-r--r-- 1 root root 8 Feb 26 04:55 luckybackup_restart -rw-r--r-- 1 root root 8 Feb 26 03:13 TVHeadend_IPTV_update -rw-r--r-- 1 root root 8 Feb 26 01:00 speedtest_ookla -rw-r--r-- 1 root root 8 Feb 25 23:15 Encode -rw-r--r-- 1 root root 8 Feb 25 07:36 Backup_Media --- root@AlsServerII:~# ls -ltr /tmp/user.scripts/finished/ total 40 -rw-r--r-- 1 root root 8 Feb 25 07:36 Backup_Media -rw-r--r-- 1 root root 8 Feb 25 23:15 Encode -rw-r--r-- 1 root root 8 Feb 26 01:00 speedtest_ookla -rw-r--r-- 1 root root 8 Feb 26 03:13 TVHeadend_IPTV_update -rw-r--r-- 1 root root 8 Feb 26 04:55 luckybackup_restart -rw-r--r-- 1 root root 8 Feb 26 07:00 Calibre_Web_Import -rw-r--r-- 1 root root 8 Feb 26 07:00 Avidemux_TVH_Trigger -rw-r--r-- 1 root root 8 Feb 26 07:08 Fan_Control_HDD -rw-r--r-- 1 root root 8 Feb 26 07:09 Fan_Control_CPU -rw-r--r-- 1 root root 8 Feb 26 07:09 CF_DNS_Updater root@AlsServerII:~#  1 Quote Link to comment
hawihoney Posted February 26 Share Posted February 26 (edited) 6 minutes ago, alturismo said: may add another script like, will sort the last finished actions  I would like to see that at the source - at the User Scripts page itself. With your output I have to switch around between page and output. Thanks anyway.  But you create an idea to delete the logs myself - with a User Script  Just need a way to refresh the page then ...  This is one half of my User Scripts page - just to get an idea what I'm talking about:  Edited February 26 by hawihoney 1 Quote Link to comment
FlamongOle Posted February 27 Share Posted February 27 root@Odin:~# /usr/local/emhttp/plugins/user.scripts/startSchedule.php hourly bash: /usr/local/emhttp/plugins/user.scripts/startSchedule.php: Permission denied root@Odin:~# php /usr/local/emhttp/plugins/user.scripts/startSchedule.php hourly /usr/local/emhttp/plugins/user.scripts/backgroundScript.sh "/tmp/user.scripts/tmpScripts/dynu_updater_hourly/script" >/dev/null 2>&1/usr/local/emhttp/plugins/user.scripts/backgroundScript.sh "/tmp/user.scripts/tmpScripts/pfsense_firewall/script" >/dev/null 2>&1 Â Noticed that I got a permission error in the logs from the User Scripts plugin, it looks like Unraid does not accept the #!/usr/bin/php anymore. I had to add "php" in front of the startSchedule.php in the crontab file to make it work. Can someone test this, I wanna know if it's just my system or a bug/glitch.. 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.