Squid 2963 Posted June 10, 2020 Author Share Posted June 10, 2020 What are you expecting to happen? Does Schedule Applied appear and the Apply button go back to being grayed out after hitting it? Quote Link to post
antagon 2 Posted June 11, 2020 Share Posted June 11, 2020 (edited) I expect it to safe the new schedule status, but it doesn´t. Apply doesn´t work for me, no schedule applied message. I deinstalled and reinstalled user scripts. Same problem. Edited June 11, 2020 by antagon Quote Link to post
DigitalDivide 0 Posted June 13, 2020 Share Posted June 13, 2020 (edited) I'm getting the following error on m y move script Script location: /tmp/user.scripts/tmpScripts/SonarrCopy/script Note that closing this window will abort the execution of this script mv: cannot move '/mnt/disks/DELUGETorrents/Seedbox_Downloads/The 100 Season 3 [1080p] WEB-DL H264' to '/mnt/disks/DELUGETorrents/Sonarr_Pickup/The 100 Season 3 [1080p] WEB-DL H264': File exists mv: cannot move '/mnt/disks/DELUGETorrents/Seedbox_Downloads/The.100.S06.1080p.BluRay.x264-TURMOiL' to '/mnt/disks/DELUGETorrents/Sonarr_Pickup/The.100.S06.1080p.BluRay.x264-TURMOiL': File exists I suspect that when a folder is being moved that has 3 or 4 files in it but a copy is still copying the rest of the files there, when the script runs an hour later and sees an existing folder it won't overwrite it. Is there a way to have my script below overwrite an existing folder? #!/bin/bash shopt -s extglob mv /mnt/disks/DELUGETorrents/Seedbox_Downloads/!(.sync*.*) /mnt/disks/DELUGETorrents/Sonarr_Pickup/ Would this be correct? mv - f /mnt/disks/DELUGETorrents/Seedbox_Downloads/!(.sync*.*) /mnt/disks/DELUGETorrents/Sonarr_Pickup/ As well, if I want to change the above script to not copy files ending in a .tmp extension instead would it read mv - f /mnt/disks/DELUGETorrents/Seedbox_Downloads/!(*.tmp) /mnt/disks/DELUGETorrents/Sonarr_Pickup/ Edit: tried the -f but that didn't work...not sure if I have it in the wrong place or just have it wrong Edited June 13, 2020 by DigitalDivide Quote Link to post
DigitalDivide 0 Posted June 13, 2020 Share Posted June 13, 2020 (edited) So I tried #!/bin/bash shopt -s extglob mv [-f]/mnt/disks/DELUGETorrents/Seedbox_Downloads/*.mkv /mnt/disks/DELUGETorrents/Sonarr_Pickup/ However that didn't work. I got the following errror now. I think that's because some files are in the folder /seedbox_downloads itself and some get dumped into folders beneath it and the script it just looking at the top folder which in this case has no files in it but the subfolders do...I'm guessing....I guess I need the script to copy all .mkv files in the top folder and any folders with .mkv files in it as well. Script location: /tmp/user.scripts/tmpScripts/SonarrCopy/script Note that closing this window will abort the execution of this script mv: cannot stat '[-f]/mnt/disks/DELUGETorrents/Seedbox_Downloads/*.mkv': No such file or directory Edited June 13, 2020 by DigitalDivide clarify Quote Link to post
mgutt 387 Posted June 13, 2020 Share Posted June 13, 2020 (edited) The [-f] in the documentation means that -f is optional. You must not type the brackets in your script to use it. And you made a second mistake. You did not add a white space, so mv tried to find the path "[-f]/mnt...". That's the reason why it returned the "no such directory" error. Edited June 13, 2020 by mgutt Quote Link to post
DigitalDivide 0 Posted June 13, 2020 Share Posted June 13, 2020 (edited) ok modified to #!/bin/bash shopt -s extglob mv -f mnt/disks/DELUGETorrents/Seedbox_Downloads/*.mkv /mnt/disks/DELUGETorrents/Sonarr_Pickup/ Got the exact same error. I double checked and there is a folder beneath seedbox_downloads with a bunch of mkv files. I wondering about something else as well. If the tv series folder in /seedbox_downloads/ is still being written to and the script runs, it can't actually move the folder can it? Does it mean that will just move the episodes that have completed and have a *.mkv extension. When they are being written to they have a *.tmp extension. Edited June 13, 2020 by DigitalDivide clarify Quote Link to post
DigitalDivide 0 Posted June 13, 2020 Share Posted June 13, 2020 (edited) So I put back my orig script and just added the -f to see if it won't overwrite without prompting on giving an error. I got the arror below but it did move the files. Script location: /tmp/user.scripts/tmpScripts/SonarrCopy/script Note that closing this window will abort the execution of this script mv: cannot move '/mnt/disks/DELUGETorrents/Seedbox_Downloads/The 100 Season 3 [1080p] WEB-DL H264' to '/mnt/disks/DELUGETorrents/Sonarr_Pickup/The 100 Season 3 [1080p] WEB-DL H264': File exists So to my orig script below I changed it to read below and it doesn't do anything. I'm so confused at this point. mv -f /mnt/disks/DELUGETorrents/Seedbox_Downloads/!(*.tmp) /mnt/disks/DELUGETorrents/Sonarr_Pickup/ Orig script #!/bin/bash shopt -s extglob mv /mnt/disks/DELUGETorrents/Seedbox_Downloads/!(.sync*.*) /mnt/disks/DELUGETorrents/Sonarr_Pickup/ Edited June 13, 2020 by DigitalDivide Quote Link to post
mgutt 387 Posted June 13, 2020 Share Posted June 13, 2020 Hmm I wonder why this does not work. But you can instead use rsync with the --remove-source-files option. This will delete the source after it has been transfered to the target. Example: rsync -a --remove-source-files --exclude=".sync*" /mnt/disks/DELUGETorrents/Seedbox_Downloads/ /mnt/disks/DELUGETorrents/Sonarr_Pickup/ Explanation: -a = -rlptgoD = recursive, symbolic links, preserve all auth, preserve date --remove-soure-files = delete source file after transfer --exclude=".sync*" = ignore files starting with ".sync Another useful setting if you want to use rsync to sync two folders: --delete = delete files in the target that are not present in the source (not useful in combination with "--remove-soure-files") Quote Link to post
DigitalDivide 0 Posted June 13, 2020 Share Posted June 13, 2020 The problem is rscync is a copy that takes much longer. The pickup folder is being watched by Sonarr to copy the files to the final destination. If the file is still being written I have a feeling Sonarr might try to copy a partial file that rsync is still copying. Move is done instantly. Quote Link to post
mgutt 387 Posted June 13, 2020 Share Posted June 13, 2020 (edited) Do you maybe aren't allowed to delete the target file? In this manual it says that the target file is removed before the local file is moved: https://unix.stackexchange.com/a/236676/101920 You should test it in a script by using rm: rm '/mnt/disks/DELUGETorrents/Sonarr_Pickup/The 100 Season 3 [1080p] WEB-DL H264' Edited June 13, 2020 by mgutt Quote Link to post
DigitalDivide 0 Posted June 13, 2020 Share Posted June 13, 2020 When I do the remove command it tells me it can't because it's a directory. rm: cannot remove '/mnt/disks/DELUGETorrents/Sonarr_Pickup/The.100.S06.1080p.BluRay.x264-TURMOiL': Is a directory I tried with a file in it and with no files in the folder. Same message. Seems rm can't remove a folder...?? Quote Link to post
DigitalDivide 0 Posted June 13, 2020 Share Posted June 13, 2020 Ok that worked. So I know the folder can be removed. I think it just can't overwrite an existing folder when I use the mv command Quote Link to post
JoeUnraidUser 25 Posted June 13, 2020 Share Posted June 13, 2020 22 minutes ago, DigitalDivide said: When I do the remove command it tells me it can't because it's a directory. rm: cannot remove '/mnt/disks/DELUGETorrents/Sonarr_Pickup/The.100.S06.1080p.BluRay.x264-TURMOiL': Is a directory I tried with a file in it and with no files in the folder. Same message. Seems rm can't remove a folder...?? Try: rm -rf /mnt/disks/DELUGETorrents/Sonarr_Pickup/The.100.S06.1080p.BluRay.x264-TURMOiL Quote Link to post
DigitalDivide 0 Posted June 13, 2020 Share Posted June 13, 2020 I think you may have missed what I typed above. The below did remove the folder. The issue is now with the MV command. I don't think it will overwrite an existing folder. I think I may just have to leave things as they are. rm '/mnt/disks/DELUGETorrents/Sonarr_Pickup/The 100 Season 3 [1080p] WEB-DL H264' Quote Link to post
Aerodb 4 Posted June 13, 2020 Share Posted June 13, 2020 On 6/10/2020 at 11:25 AM, Squid said: What are you expecting to happen? Does Schedule Applied appear and the Apply button go back to being grayed out after hitting it? Same issue happened for me. If I change the timing(or disable) any of the scripts, apply lights up(so i can click it). but when i actually click, nothing happens. upon refresh or revisiting this page the changes are not saved. it worked a few minutes ago but not its not. Quote Link to post
Squid 2963 Posted June 13, 2020 Author Share Posted June 13, 2020 8 minutes ago, Aerodb said: Same issue happened for me. If you look at the syslog (Tools), do you see "bread" errors? Quote Link to post
Aerodb 4 Posted June 13, 2020 Share Posted June 13, 2020 1 minute ago, Squid said: If you look at the syslog (Tools), do you see "bread" errors? I do not see an Errors with any "bread" text. one error but doesn't seem related. Error text below just in case its helpful. error start- Jun 13 17:57:20 SCRUBBED nginx: 2020/06/13 17:57:20 [error] 15488#15488: *12780505 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /admin/api.php?version HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "127.0.0.1" Jun 13 17:57:20 SCRUBBED nginx: 2020/06/13 17:57:20 [error] 15488#15488: *12780507 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /admin/api.php?version HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "localhost" Quote Link to post
mgutt 387 Posted June 14, 2020 Share Posted June 14, 2020 1 hour ago, DigitalDivide said: Ok that worked. So I know the folder can be removed. I think it just can't overwrite an existing folder when I use the mv command Yes, that's correct. Sorry, I thought it was a file because mv returned a file error instead of "Directory not empty" error for directories. mv is not able to merge dirs. cp is able to do that. Example: cp -al source/folder destination rm -r source/folder The -l option causes to create hardlinks instead of copying the files. But cp does not contain an exclude flag so it does not solve your problem. Instead use rsync "--link-dest=". By that it creates hardlinks and does NOT copy the files and after that "--remove-source-files" removes the initial hardlink of a file: rsync -a --remove-source-files --exclude=".sync*" --link-dest=/mnt/disks/DELUGETorrents/Seedbox_Downloads/ /mnt/disks/DELUGETorrents/Seedbox_Downloads/ /mnt/disks/DELUGETorrents/Sonarr_Pickup/ Sadly it does not remove the empty dirs in the source. This needs a separate command: https://unix.stackexchange.com/a/46326/101920 Quote Link to post
antagon 2 Posted June 15, 2020 Share Posted June 15, 2020 On 6/14/2020 at 1:11 AM, Squid said: If you look at the syslog (Tools), do you see "bread" errors? no "bread" errors for me. One thing I see is one user scipts related error: root: error: /plugins/user.scripts/exec.php: uninitialized csrf_token Quote Link to post
Squid 2963 Posted June 15, 2020 Author Share Posted June 15, 2020 2 hours ago, antagon said: uninitialized csrf_token That would definitely cause the problem you're seeing. Only time the forum has ever seen that error is when either rootfs or tmpfs is completely full. If you can, post a diagnostics. Either way, a reboot is going to be required. Quote Link to post
Ecsport108 0 Posted June 15, 2020 Share Posted June 15, 2020 (edited) On 6/9/2020 at 2:55 AM, Ecsport108 said: Hello. I am running into a slight issue. I just updated from 6.7.2 to 6.8.3 (a little late, I know) and it seems to have broken one of my scripts. Any time I try to run or the done button never appears which leads me to believe the script is hanging. If I open the docker tab of the web ui in another browser tab without closing the script, the docker service appears to have started and works fine. However, closing the script in the original tab causes it to abort leading the docker service to return that it failed to start despite it working fine up until then. I have deleted my docker image to verify that it was not an issue with docker and the issue persists. Executing the same commands from the terminal works fine. Any help would be very appreciated! Is anyone else having issues running either of these commands. Alternatively, does anyone have any ideas I what I can do to correct this issue. I can still run the commands manually it's just a bit annoying. Edited June 15, 2020 by Ecsport108 Quote Link to post
antagon 2 Posted June 16, 2020 Share Posted June 16, 2020 (edited) 17 hours ago, Squid said: That would definitely cause the problem you're seeing. Only time the forum has ever seen that error is when either rootfs or tmpfs is completely full. If you can, post a diagnostics. Either way, a reboot is going to be required. there you go tower-diagnostics-20200616-0727 2.zip Edited June 16, 2020 by antagon Quote Link to post
mgutt 387 Posted June 16, 2020 Share Posted June 16, 2020 Maybe someone needs a script for file encryption: Quote Link to post
mgutt 387 Posted June 17, 2020 Share Posted June 17, 2020 CA User Scripts does not kill scripts! Quote Link to post
Squid 2963 Posted June 17, 2020 Author Share Posted June 17, 2020 Yes it does. However, any long-running processes spawned by the script will run to completion. (ie: your rsync) Quote Link to post
1233 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.