mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-03-02 22:57:32 -05:00
Run External Program Upon Completion Not Working #14549
Labels
No labels
Accessibility
AppImage
Bounty
Build system
CI
Can't reproduce
Code cleanup
Confirmed bug
Confirmed bug
Core
Crash
Data loss
Discussion
Docker
Documentation
Duplicate
Feature
Feature request
Feature request
Feature request
Filters
Flatpak
GUI
Has workaround
I2P
Invalid
Libtorrent
Look and feel
Meta
NSIS
Network
Not an issue
OS: *BSD
OS: Linux
OS: Windows
OS: macOS
PPA
Performance
Project management
Proxy/VPN
Qt bugs
Qt6 compat
RSS
Search engine
Security
Temp folder
Themes
Translations
Triggers
Waiting diagnosis
Waiting info
Waiting upstream
Waiting web implementation
Watched folders
WebAPI
WebUI
autoCloseOldIssue
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/qBittorrent#14549
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Decoy256 on GitHub (Apr 27, 2023).
qBittorrent & operating system versions
qBittorrent: 4.5.2 (qbittorrent-nox)
OS: TrueNAS-13.0-U4 - qBittorrent is running inside a jail which is running FreeBSD version 13.2-RELEASE
Qt: 5.15.8
Libtorrent: 1.2.18.0
Boost: 1.81.0
OpenSSL: 1.1.1t-freebsd
zlib: 1.2.13
What is the problem?
I have searched through the forums here and elsewhere trying to solve this, but nothing seems to work.
I am running a simple command upon torrent completion: unrar x -r "%F"/*.rar "%F"/
This WAS working flawlessly for months, but suddenly it stopped working. I've even completely removed the entire jail and reinstalled, but the problem persists.
Looking at the log file, it indicates that it runs the command, but I think it's lying. I tried to test what might be the problem and so gave it another command to run upon completion: echo "test" > /config/debug.txt
Again, the log says it ran this command, but the file is not created. Why does it think that it's running the command, but producing nothing from even the simplest of commands?
I've seen that others have had issues with qBittorrent not running bash scripts upon completion, but I'm not running bash scripts, just a simple unrar command (or even a simple "echo" command apparently).
Steps to reproduce
Additional context
No response
Log(s) & preferences file(s)
No response
@krmcleod02 commented on GitHub (Apr 27, 2023):
Same issue.
Running direct on Ubuntu 22.04 LTS. Was working fine under 4.3, upgraded a few days ago to 4.5.2 for the sake of upgrading, and both the unrar and 7z external scripts refuse to run.
@glassez commented on GitHub (Apr 27, 2023):
Could you test it with full paths of running programs specified?
@Decoy256 commented on GitHub (Apr 28, 2023):
@glassez I could, but it doesn't even run "echo", so I'm not sure if that would change anything.
Also, I can run "unrar" from the command line without the full path.
And the qBittorrent logs show that it is running these commands, but to no effect.
@Decoy256 commented on GitHub (Apr 28, 2023):
@krmcleod02 Have you checked out the qBittorrent logs to see if it thinks that it is running the commands?
@glassez commented on GitHub (Apr 28, 2023):
It is because the log message is posted unconditionally:
github.com/qbittorrent/qBittorrent@9801cd0323/src/app/application.cpp (L518-L521)@glassez commented on GitHub (Apr 28, 2023):
IIRC, "echo" is built-in command of shell and not an executable so it cannot be run by qBittorrent.
So I want to first find out if the problem is just that PATH is not available to the running process.
@Decoy256 commented on GitHub (Apr 28, 2023):
Well, that's dumb. Kind of a pointless "log" if it isn't logging what actually happens. Can we submit that as a bug?
@glassez commented on GitHub (Apr 28, 2023):
Sure.
@krmcleod02 commented on GitHub (Apr 28, 2023):
So the log is showing it runs it against every torrent that's downloaded, but it doesn't report whether or not it's complete. My configuration keeps In Progress torrents in one folder, and then moves them to another for Completed downloads.
This is what is coming up in the log:
(N) 2023-04-28T15:46:18 - Enqueued torrent move. Torrent: #TORRENT NAME#. Source: #TORRENT LOCATION#. Destination: #DESTINATION LOCATION#
(N) 2023-04-28T15:46:18 - Start moving torrent. Torrent: #TORRENT NAME#. Destination: #DESTINATION LOCATION#
(N) 2023-04-28T15:46:18 - Moved torrent successfully. Torrent: #TORRENT NAME#. Destination: #DESTINATION LOCATION#
(N) 2023-04-28T15:46:18 - Torrent download finished. Torrent: #TORRENT NAME#
(N) 2023-04-28T15:46:18 - Running external program. Torrent: #TORRENT NAME#. Command:
"/usr/local/bin/unrar" x -ibck -inul "#DESTINATION LOCATION#/*.r*" "#UNPACK LOCATION#"Redacted for my own peace of mind. However, it doesn't give a report that it completed the External command, just claims that it ran it. It is pointing against the post move location when it reports the Unrar command. It just doesn't unpack the file.
@Decoy256 commented on GitHub (Apr 28, 2023):
@glassez It looks like the log posted by @krmcleod02 indicates that he is feeding it the full path.
I can't recall, but I think I might have run across this (providing the full path) as a suggestion a while ago in another thread somewhere on the internet (I've been dealing with this issue for some time) and I tried giving it the full path, but to no avail.
@glassez commented on GitHub (Apr 29, 2023):
I did a couple of quick tests and I see that it really runs (even w/o full path specified). Maybe the problem is not that it does not start, but that it cannot do useful work for some reason (for example, because of incorrect parameters or something else). Could you run qBittorrent from the console/terminal to see the output of the program being run?
@glassez commented on GitHub (Apr 29, 2023):
Even with this patch applied it won't report the status of executed programs (only whether or not it is started successfully) since the external process is started as detached.
@Decoy256 commented on GitHub (Apr 29, 2023):
@glassez I am not sure what you mean by "run qbittorrent". The service is running at startup.
@glassez commented on GitHub (Apr 29, 2023):
I mean start it manually, i.e. by typing the name of qBittorrent executable in shell command line. Just don't ask me how to do it in your system - I don't familiar with all these jails, etc.
@Decoy256 commented on GitHub (Apr 29, 2023):
If I just type "/usr/local/etc/rc.d/qbittorrent", it says:
When I type "/usr/local/etc/rc.d/qbittorrent restart", it outputs:
@glassez commented on GitHub (Apr 29, 2023):
"/usr/local/etc/rc.d/qbittorrent" isn't a qBittorrent itself. It looks like some script that manages qBittorrent to be used as a service. You could read it to see how it executes qBittorrent.
P.S. you still need to stop running service instance before start it manually.
@Decoy256 commented on GitHub (Apr 29, 2023):
This is the contents of the script:
@Decoy256 commented on GitHub (Apr 29, 2023):
This is what happens when I run
/usr/local/bin/qbittorrent-nox:https://www.imgbly.com/ib/wLe2BWortD
@glassez commented on GitHub (Apr 29, 2023):
First of all you should stop currently running qBittorrent service (as I said above) to prevent conflicts of used ports etc.
Second is you should start qBittorrent using the same user/group and command line parameters (e.g.
--profile, but except--daemon) as configured to be used by service instance (otherwise you starts it using another profile).@Decoy256 commented on GitHub (Apr 29, 2023):
So, could I just edit the script above and comment out the line that says
command_args="--daemon"?@glassez commented on GitHub (Apr 29, 2023):
You could try... Nothing terrible will happen (the main thing is, don't forget to put everything back in its place later).
Sorry, I'm not a *nix guru to confidently answer such questions (I use Windows 99% of the time).
@Decoy256 commented on GitHub (Apr 29, 2023):
If there is nothing else in that script that you think might cause problems, then I think I'll give that a try.
@Decoy256 commented on GitHub (Apr 29, 2023):
OK, I commented it out and it seems to work, except when I stop the jail and then restart it, the TrueNAS UI hangs and doesn't register that it has finished starting the jail. That's OK, since I can just refresh the UI and I can still shell into the jail. I will test to see if this fixes the execute external program issue. If it does work, that show what? That qbittorrent isn't properly handling the fact that it is running as a daemon? What would be the solution from there?
@Decoy256 commented on GitHub (Apr 29, 2023):
OK, I got it running with a torrent set to download, then went out for the day. Came back and the torrent has been stalled the whole time. Reset the script back to the way it was and everything started up and ran. Still not executing commands on completion, though.
@glassez commented on GitHub (Apr 30, 2023):
Well, it could still be because you ran it through a rc script...
In fact, if you are ready to just test it without having to seed all your existing torrents, then you could run it manually with a clean profile (as you did earlier, but don't forget to stop the service instance first and then make sure your manually started instance is OK by looking at qBittorrent log) and add a single torrent for downloading.
@glassez commented on GitHub (Apr 30, 2023):
@qbittorrent/bug-handlers, could someone help with troubleshooting this issue?
@glottisfaun0000 commented on GitHub (May 1, 2023):
i'm having this same issue with qb 4.5.2 on macOS with the same results as @Decoy256 including when running with the path, e.g. "/usr/bin/touch ~/hi.txt". shows in log, nothing happened in filesystem.
@glassez commented on GitHub (May 2, 2023):
Although
~has a special meaning for many command line shells it is just a regular character and it is interpreted accordingly by other software. "touch /home/glassez/hi.txt" works well for me.@krmcleod02 commented on GitHub (May 2, 2023):
Apparently in a recent update, unrar somehow moved locations to /usr/bin in my case. I still had a residual location of /usr/local/bin/unrar, but it did nothing. The PATH had been changed.
After updating my command, it's running fine. Sorry for the confusion.
@glottisfaun0000 commented on GitHub (May 3, 2023):
does running external program support piping?
such as,
echo "%N" | /opt/homebrew/bin/notify
@glassez commented on GitHub (May 4, 2023):
No. All it does is call the executable and pass everything else to it as parameters. If you need some features of shell, then you could call the shell (e.g. bash) and pass it the appropriate parameters.