Squid 2894 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 post
jonathanm 1159 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 post
itimpi 839 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 post
Squid 2894 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 post
jonathanm 1159 Posted November 16, 2019 Share Posted November 16, 2019 6 minutes ago, itimpi said: If you run your own scripts directly from the flash drive then you have to do something to get them to run correctly. So appending the /bin/bash like Squid says before the path to the script is sufficient? I'm not running the script directly, I'm running them from another user script using the at now technique. I have a bunch of conditional startup scripts that take care of timing of various VM and container launches, since Unraid doesn't provide a way of managing that sort of thing in the GUI. All this is on my 6.7 box, I haven't played around with it on my test boxes yet, but I want to make sure all my ducks are in a row before I apply 6.8. I'm hoping instead of making me do all the testing and validation work, you guys will just tell me how to make it work and I can be lazy. 😁 Quote Link to post
Squid 2894 Posted November 16, 2019 Author Share Posted November 16, 2019 2 minutes ago, jonathanm said: appending prepending 2 minutes ago, jonathanm said: is sufficient? Yes 3 minutes ago, jonathanm said: I'm not running the script directly, I'm running them from another user script using the at now technique. You actually are running it directly (via the user script) Quote Link to post
Squid 2894 Posted November 16, 2019 Author Share Posted November 16, 2019 5 minutes ago, jonathanm said: I can be lazy. 👍 Quote Link to post
scubieman 15 Posted November 23, 2019 Share Posted November 23, 2019 When I click abort scripts it doesnt kill the script from running. Any ideas? Or how to troubleshoot ? Quote Link to post
Squid 2894 Posted November 23, 2019 Author Share Posted November 23, 2019 Any long running commands will get aborted after they are finished. I've tried many ways of terminating, and I keep running into the same problem. I cant kill the PID of any long ru ing command (rsync) Quote Link to post
scubieman 15 Posted November 23, 2019 Share Posted November 23, 2019 Ok, well its more of me backing up to b2. There is 150 GB to go. So I only want it going at night. I have to find process then kill pid. Unless you have easy way to find the pid? AKA search for pid including name rclone Quote Link to post
Squid 2894 Posted November 23, 2019 Author Share Posted November 23, 2019 ps command 1 Quote Link to post
je82 18 Posted December 4, 2019 Share Posted December 4, 2019 Anyway to figure out why a script decided not to run? This script didn't run today even though it should have: Quote Link to post
kortina 0 Posted December 6, 2019 Share Posted December 6, 2019 looking for a bit of scripting help... I am trying to fetch a TV Guide (xml file) that is around 40Mb. The server is unreliable. using this: curl -L --limit-rate 200K "http://provider.url/epg?username=un&password=pw" --speed-time 15 --speed-limit 1000 -o /mnt/user/appdata/tvheadend/data/cronIPTV_EPG.xml I have run this multiple times my so I know the syntax is OK. but about 3 in 5 fail!!! output: curl: (28) Operation too slow. Less than 1000 bytes/sec transferred the last 15 seconds How do I wrap this command in a loop so that it will try 10 times if it falls over with the "operation too slow" error? Quote Link to post
caplam 9 Posted December 10, 2019 Share Posted December 10, 2019 Hello, I usually use user script for various backup tasks. For the need of my home automation system i have to run a python script which is intended to listen push on a port. The script can be found here. I have nerdpack plugin installed. When i launch the script i have the following error. Quote Script location: /tmp/user.scripts/tmpScripts/Bridge_Jeedom_InfluxDB.py/script Note that closing this window will abort the execution of this script Traceback (most recent call last): File "/tmp/user.scripts/tmpScripts/Bridge_Jeedom_InfluxDB.py/script", line 5, in from http.server import BaseHTTPRequestHandler, HTTPServer ImportError: No module named http.server How can i install this module ? I thought it was included. Can I launch python script with user script ? How can i make the script running in background ? It needs to listen to push events. Quote Link to post
caplam 9 Posted December 10, 2019 Share Posted December 10, 2019 I think i solved my problem. i had to change the first line from #!/usr/bin/python to #!/usr/bin/python3 I also had to install influxdb in a shell window: pip3 install influxdb Now i'm waiting for the first push to come. If i understand right the script has to be lauched with "&" at the end off the command line in order to run without the window opened. My bad the "run in background" button is huge but i had not seen it. So i started the script with run un background. I also sheduled a run at array startup Quote Link to post
wgstarks 213 Posted December 11, 2019 Share Posted December 11, 2019 With the changes to flash security in 6.8 should I move my custom scripts run via this plugin to a location other than flash? Just want to be sure I’ll still be able to run, edit and create new scripts if the scripts folder is still on flash. Quote Link to post
itimpi 839 Posted December 11, 2019 Share Posted December 11, 2019 As long as you do the editing and running via the User Scripts plugin then there is no problem as it handles this correctly for the new security settings. 1 Quote Link to post
Tuumke 1 Posted December 12, 2019 Share Posted December 12, 2019 Is it possible to have your user script log to its own logfile? Quote Link to post
Squid 2894 Posted December 12, 2019 Author Share Posted December 12, 2019 10 hours ago, Tuumke said: Is it possible to have your user script log to its own logfile? All scripts log to their own log file which can be viewed / downloaded 1 Quote Link to post
FunnyPocketBook 5 Posted December 23, 2019 Share Posted December 23, 2019 I'm trying to run a python script every minute with this plugin but I cannot get it to work. I created a new entry, set scheduling to custom with `* * * * * *` as expression. The content of the script is #!/bin/bash /usr/bin/python3.7 /mnt/user/walzen/nzbget_download_rate.py Running manually (clicking on "Run Script" or "Run in Background") works perfectly fine but for some reason it doesn't execute automatically. I have other cron jobs (bash scripts) that are working normally. Quote Link to post
Squid 2894 Posted December 23, 2019 Author Share Posted December 23, 2019 8 minutes ago, FunnyPocketBook said: `* * * * * *` What is the expression your using? Because it should only be 5 *, not 6 1 Quote Link to post
FunnyPocketBook 5 Posted December 23, 2019 Share Posted December 23, 2019 1 hour ago, Squid said: What is the expression your using? Because it should only be 5 *, not 6 Oh my god, I'm such an idiot... Thanks a lot! I spent more than 4 hours trying absolutely everything and didn't even think of checking my expression Quote Link to post
Xe138 0 Posted January 1, 2020 Share Posted January 1, 2020 So I was using User Scripts as normal, but after manually running and cancelling a script the page now seems to be broken. This is all that is shown. "Appdata Backup" was one of my scripts but the description appears to be the html for the entire page. I tried uninstalling and reinstalling the plugin without any change. I've also checked with another browser with the same result, so it doesn't appear to be a browser cache issue. How would I fix this? Quote Link to post
Squid 2894 Posted January 1, 2020 Author Share Posted January 1, 2020 1 hour ago, Xe138 said: So I was using User Scripts as normal, but after manually running and cancelling a script the page now seems to be broken. This is all that is shown. "Appdata Backup" was one of my scripts but the description appears to be the html for the entire page. I tried uninstalling and reinstalling the plugin without any change. I've also checked with another browser with the same result, so it doesn't appear to be a browser cache issue. How would I fix this? Not much suggestion on this fine and glorious night other than a reboot. No idea atm what went went wrong here. But, do there happen to be anything luke quotes in the name of the script? Quote Link to post
lococola 0 Posted January 1, 2020 Share Posted January 1, 2020 I want to use a script to run a rsync command, but I also want to run this from a screen, so I can check the progress at any time with screen -r. I have several backup scripts for each share that I want to backup. I'm having some issue getting screen to work. This is how the script looks now: #!/bin/bash export SCREENDIR=/root/.screen screen -dmS rsyncdms echo "Job '[job name]' started" rsync [with parameters etc] /usr/local/emhttp/webGui/scripts/notify -s "Job '[job name]' finished at $(date '+%Y-%m-%d %H:%M')" So it needs to do 3 things (echo, rsync and notify). When I run the script from the User Scripts page with the Run Script button, it works perfectly. But when I run it in the background and then try to view the status with 'screen -r' in a terminal, I just get a blank terminal with a prompt. I read it's because you need to put something immediately behind the 'screen -dmS rsyncdms' command, but then it still doesn't work. How can I get these 3 things to be executed in order, all within its own screen session? I saw another post where someone made a new user script and within it called the .sh file, but I want to integrate the screen function within the backup script itself, if possible. Quote Link to post
1216 posts in this topic Last Reply
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.