DZMM Posted October 9, 2019 Share Posted October 9, 2019 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. Quote Link to comment
NewDisplayName Posted October 9, 2019 Share Posted October 9, 2019 (edited) 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, 2019 by nuhll Quote Link to comment
xTxHiLLx Posted October 24, 2019 Share Posted October 24, 2019 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? Quote Link to comment
Squid Posted October 26, 2019 Author Share Posted October 26, 2019 Long running commands do not get aborted.Sent from my NSA monitored device Quote Link to comment
Marcel40625 Posted October 26, 2019 Share Posted October 26, 2019 (edited) 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, 2019 by Marcel40625 Quote Link to comment
bastl Posted October 30, 2019 Share Posted October 30, 2019 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 Quote Link to comment
Squid Posted October 30, 2019 Author Share Posted October 30, 2019 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 Quote Link to comment
bastl Posted October 30, 2019 Share Posted October 30, 2019 @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. Quote Link to comment
itimpi Posted October 30, 2019 Share Posted October 30, 2019 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. Quote Link to comment
bastl Posted October 30, 2019 Share Posted October 30, 2019 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? Quote Link to comment
itimpi Posted October 30, 2019 Share Posted October 30, 2019 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. Quote Link to comment
bastl Posted October 30, 2019 Share Posted October 30, 2019 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 😂 Quote Link to comment
itimpi Posted October 30, 2019 Share Posted October 30, 2019 I wonder if the CA Config Editor could be extended to allow for editing UserScripts script files? Quote Link to comment
Squid Posted October 30, 2019 Author Share Posted October 30, 2019 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 Quote Link to comment
scubieman Posted October 30, 2019 Share Posted October 30, 2019 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. Quote Link to comment
itimpi Posted October 30, 2019 Share Posted October 30, 2019 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. 1 Quote Link to comment
bonienl Posted October 30, 2019 Share Posted October 30, 2019 1 hour ago, bastl said: All in all it's not a big deal Maybe change to nicht erfolgreich 😉 1 Quote Link to comment
Viperean Posted November 12, 2019 Share Posted November 12, 2019 (edited) 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, 2019 by Viperean removed diagnostics.zip Quote Link to comment
Squid Posted November 12, 2019 Author Share Posted November 12, 2019 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 Quote Link to comment
Viperean Posted November 12, 2019 Share Posted November 12, 2019 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. Quote Link to comment
tmchow Posted November 16, 2019 Share Posted November 16, 2019 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? Quote Link to comment
Squid Posted November 16, 2019 Author Share Posted November 16, 2019 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 Quote Link to comment
JonathanM Posted November 16, 2019 Share Posted November 16, 2019 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/... ? Quote Link to comment
itimpi Posted November 16, 2019 Share Posted November 16, 2019 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. Quote Link to comment
Squid Posted November 16, 2019 Author Share Posted November 16, 2019 (edited) 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, 2019 by Squid 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.