October 9, 20196 yr On 9/20/2019 at 10:51 AM, DZMM said: Hi can I get some help with what is probably an easy fix please. I've started using this python utility https://github.com/adamgot/python-plexlibrary where I've saved the files to /mnt/user/appdata/other/python-plexlibrary-master. When I run the python utility via command line from the folder e.g. python plexlibrary movies_recommended everything works fine, but when I try to do via script e.g: #!/bin/bash cd /mnt/user/appdata/other/python-plexlibrary-master python plexlibrary movies_recommended exit I get this error: Traceback (most recent call last): File "/usr/lib64/python2.7/runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/mnt/user/appdata/other/python-plexlibrary-master/plexlibrary/__main__.py", line 3, in main() File "plexlibrary/plexlibrary.py", line 61, in main r.run(args.sort_only) File "plexlibrary/recipe.py", line 696, in run missing_items, list_count = self._run() File "plexlibrary/recipe.py", line 172, in _run matching_total, item['title'], item['year'])) UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 23: ordinal not in range(128) I've also tried: #!/usr/bin/env python cd /mnt/user/appdata/other/python-plexlibrary-master plexlibrary movies_recommended plexlibrary movies_imdb_top_250 exit Help please Help please Me again. Can someone tell me what I'm doing wrong to run a python script please. When I run the commands: cd /mnt/user/appdata/other/python-plexlibrary-master python plexlibrary movies_recommended via putty all is well, but when I try to run a script: #!/bin/bash cd /mnt/user/appdata/other/python-plexlibrary-master python plexlibrary movies_recommended exit I get errors.
October 9, 20196 yr I have no coding exp. But does this work by any chance? python /mnt/user/appdata/other/python-plexlibrary-master/plexlibrary movies_recommended Edited October 9, 20196 yr by nuhll
October 24, 20196 yr Unraid Newb here. I recently setup a fully automated experience with Plex, Sonarr, Radarr, qbittorrent, and Jackett. I have qbittorrent set to automatically remove torrents after either a 1:1 ratio or after 7 days (to fulfill all tracker seeding requirements). However, I noticed its removing the torrent from qbitt but not removing it from /mnt/user/downloads. So I downloaded CA User Scripts and wrote a one liner to handle this: sudo find /mnt/user/downloads/ -mtime +7 -exec rm -rf {} \; Is there a better way to do this? Its preferable to remove the file in /mnt/user/downloads by the downloader. Does anyone know if rtorrent does this?
October 26, 20196 yr Author Long running commands do not get aborted.Sent from my NSA monitored device
October 26, 20196 yr Hey there, very good plugin! But i have a question: can we maybe have subdirectorys? Example: /Backups/Scriptfolder so you can put all backup scripts in that one subdirectory and in the webui theres a drop down or something similar Edited October 26, 20196 yr by Marcel40625
October 30, 20196 yr I'am using a script for snapshotting VMs on BTRFS formatted drive which informs me via telegram when finished. Switching to 6.8.RC4 and adjusting some paths in the script I've noticed some german letters (ä ö ü) getting removed by the script when saving. Never happened in earlier builds. The affected line is the following: /usr/local/emhttp/webGui/scripts/notify -i normal -s "BTRFS Send/Receive beendet" -d "Script ausgefhrt" -m "$(date '+%Y-%m-%d %H:%M') Information: BTRFS VM Offline Snapshot auf HDD erfolgreich abgeschlossen" It should be "Script ausgeführt" not "ausgefhrt". Is this an issue from the plugin itself or caused by unraid. I think there was an update for user scripts since I am on 6.8RC but not 100% sure. Any idea how to fix this? full script: #!/bin/bash #backgroundOnly=false #arrayStarted=true cd /mnt/cache/VMs_backup sd=$(echo VMs_backup_off* | awk '{print $1}') ps=$(echo VMs_backup_off* | awk '{print $2}') if [ "$ps" == "VMs_backup_offline_$(date '+%Y%m%d')" ] then echo "There's already a snapshot from today" else for i in `virsh list | grep running | awk '{print $2}'`; do virsh shutdown $i; done # Wait until all domains are shut down or timeout has reached. END_TIME=$(date -d "300 seconds" +%s) while [ $(date +%s) -lt $END_TIME ]; do # Break while loop when no domains are left. test -z "`virsh list | grep running | awk '{print $2}'`" && break # Wait a little, we don't want to DoS libvirt. sleep 1 done echo "shutdown completed" virsh list | grep running | awk '{print $2}' btrfs sub snap -r /mnt/cache/VMs /mnt/cache/VMs_backup_offline_$(date '+%Y%m%d') for i in `virsh list --all --autostart|awk '{print $2}'|grep -v Name`; do virsh start $i; done sync btrfs send -p /mnt/cache/VMs_backup/$ps /mnt/cache/VMs_backup_offline_$(date '+%Y%m%d') | btrfs receive /mnt/disks/VMs_backup_hdd if [[ $? -eq 0 ]]; then /usr/local/emhttp/webGui/scripts/notify -i normal -s "BTRFS Send/Receive beendet" -d "Script ausgefhrt" -m "$(date '+%Y-%m-%d %H:%M') Information: BTRFS VM Offline Snapshot auf HDD erfolgreich abgeschlossen" btrfs sub del /mnt/cache/$sd #btrfs sub del /mnt/disks/VMs_backup_HDD/VMs_backup/$sd else /usr/local/emhttp/webGui/scripts/notify -i warning -s "BTRFS Send/Receive gescheitert" -d "Script abgebrochen" -m "$(date '+%Y-%m-%d %H:%M') Information: Es wurde heute bereits ein Offline Snapshot erstellt" fi fi
October 30, 20196 yr Author Yeah, the plugin will do that if you edit q script with it (ton solve issues with copy / paste from the forum)Edit your script with another text editor (notepad / notepad++)Sent from my NSA monitored device
October 30, 20196 yr @Squid If I change it inside the Unraid ui, you say this is how it is? I never changed the script file itself only via ui and it always worked. 😂 No external editor involved.
October 30, 20196 yr 27 minutes ago, bastl said: @Squid If I change it inside the Unraid ui, you say this is how it is? I never changed the script file itself only via ui and it always worked. 😂 No external editor involved. There was a change introduced to strip out non-ascii characters to allow for those who did a copy/paste from forum posts as that was inserting hidden characters.
October 30, 20196 yr 7 minutes ago, itimpi said: There was a change introduced to strip out non-ascii characters to allow for those who did a copy/paste from forum posts as that was inserting hidden characters. Is it Unraid web ui erasing my letters or the plugin itself?
October 30, 20196 yr 2 minutes ago, bastl said: Is it Unraid web ui erasing my letters or the plugin itself? I believe it is the editor built into the plugin. Thus the suggestion to use an alternative editor.
October 30, 20196 yr Just now, itimpi said: I believe it is the editor built into the plugin. Thus the suggestion to use an alternative editor. All in all it's not a big deal. If I edit the script file itself with an external editor the notification comes through correctly. As long as not all german words are filtered out, I'am fine with it 😂
October 30, 20196 yr I wonder if the CA Config Editor could be extended to allow for editing UserScripts script files?
October 30, 20196 yr Author 11 minutes ago, itimpi said: I wonder if the CA Config Editor could be extended to allow for editing UserScripts script files? Yeah no problems itll do it now just navigate to it
October 30, 20196 yr Can i run user scripts remotely? even from different computer or phone inside network? I want to move items from one folder to another. but i want to control when it happens.
October 30, 20196 yr 6 minutes ago, scubieman said: Can i run user scripts remotely? even from different computer or phone inside network? I want to move items from one folder to another. but i want to control when it happens. You can always run a User Script manually from the Unraid GUI. Therefore if you can get to the GUI you can run the script whenever you want.
October 30, 20196 yr 1 hour ago, bastl said: All in all it's not a big deal Maybe change to nicht erfolgreich 😉
November 12, 20196 yr Using the plugin I can't save any schedule options. When I select something such as Scheduled Daily I click apply but nothing happens. When I click done and look again the schedule is disabled. It won't save for some reason. Does anyone know how to fix this? I'll attach diagnostics here. Edited November 12, 20196 yr by Viperean removed diagnostics.zip
November 12, 20196 yr Author 13 hours ago, Viperean said: Using the plugin I can't save any schedule options. When I select something such as Scheduled Daily I click apply but nothing happens. When I click done and look again the schedule is disabled. It won't save for some reason. Does anyone know how to fix this? I'll attach diagnostics here. tower-diagnostics-20191112-0241.zip 126.55 kB · 2 downloads post the contents of /config/plugins/user.scripts/schedule.json on the flash drive
November 12, 20196 yr 2 hours ago, Squid said: post the contents of /config/plugins/user.scripts/schedule.json on the flash drive When I looked for that it was not on the drive, I manually deleted user.scripts and reinstalled. It works now. Thanks.
November 16, 20196 yr In the 6.8 RC5 release notes, it says this: In another step toward better security, the USB flash boot device is configured so that programs and scripts residing there cannot be directly executed (this is because the 'x' bit is set now only for directories). Commands placed in the 'go' file still execute because during startup, that file is copied to /tmp first and then executed from there. If you have created custom scripts you may need to take a similar approach. I have some custom scripts running with user scripts plugin on boot up. Do we have to change anything?
November 16, 20196 yr Author 14 minutes ago, tmchow said: I have some custom scripts running with user scripts plugin on boot up. Do we have to change anything? The plugin has never executed scripts directly from the flash drive
November 16, 20196 yr 35 minutes ago, Squid said: The plugin has never executed scripts directly from the flash drive Ahh, but I call other CA User Scripts from their location on the flash drive. Here is one of my scripts that runs at array start. #!/bin/bash echo "/boot/config/plugins/user.scripts/scripts/StartVM/script" | at now I do it like that because if I call the StartVM script directly at array start, it hangs the array starting process, calling it this way works fine. What path should I use instead of /boot/config/... ?
November 16, 20196 yr You do not have to worry about scripts being run by User scripts as it handles this correctly for the revised security. If you run your own scripts directly from the flash drive then you have to do something to get them to run correctly.
November 16, 20196 yr Author 10 minutes ago, jonathanm said: What path should I use instead of /boot/config/... ? You have to either copy them say to /tmp and reference that (and change the permissions appropriately) or change the line to echo "/bin/bash /boot/config/plugins/user.scripts/scripts/StartVM/script" | at now Calling a script on the flash drive directly will run afoul of the security, because even though the plugin has never executed scripts directly from the flash, it has no control over what the script actually does. Edited November 16, 20196 yr by Squid
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.