mgutt 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 comment
DigitalDivide 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 comment
DigitalDivide 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 comment
mgutt 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 comment
DigitalDivide 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 comment
mgutt 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 comment
DigitalDivide 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 comment
DigitalDivide 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 comment
DigitalDivide 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 comment
Aerodb 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 comment
Squid 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 comment
Aerodb 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 comment
mgutt 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 comment
antagon 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 comment
Squid 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 comment
Ecsport108 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 comment
antagon 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 comment
mgutt Posted June 16, 2020 Share Posted June 16, 2020 Maybe someone needs a script for file encryption: Quote Link to comment
mgutt Posted June 17, 2020 Share Posted June 17, 2020 CA User Scripts does not kill scripts! Quote Link to comment
Squid 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 comment
mgutt Posted June 17, 2020 Share Posted June 17, 2020 (edited) 1 hour ago, Squid said: Yes it does. However, any long-running processes spawned by the script will run to completion. (ie: your rsync) My script contains a loop of different short running processes (mkdir, openssl, touch) and not one long running single process. If I close f.e. the "Run Script" window it is killed completely (as expected). Edited June 17, 2020 by mgutt Quote Link to comment
Aerodb Posted June 20, 2020 Share Posted June 20, 2020 On 6/13/2020 at 6:11 PM, Squid said: If you look at the syslog (Tools), do you see "bread" errors? checked syslog, not seeing anything with the word "bread" in it. yet i cant apply any changes in the user scripts plugin. i can only run the scripts or hit done. Quote Link to comment
Squid Posted June 21, 2020 Author Share Posted June 21, 2020 Then post the diagnostics Quote Link to comment
Aerodb Posted June 29, 2020 Share Posted June 29, 2020 On 6/21/2020 at 6:20 AM, Squid said: Then post the diagnostics Sorry for the delay. I pulled the log and have attached. Think you could take a look and share some wisdom? aeroserver2-syslog-20200629-0051.zip Quote Link to comment
trurl Posted June 29, 2020 Share Posted June 29, 2020 31 minutes ago, Aerodb said: I pulled the log and have attached. That is not the diagnostics. Diagnostics includes log but also other things. Tools - Diagnostics. 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.