OpenDirectoryDownloader icon indicating copy to clipboard operation
OpenDirectoryDownloader copied to clipboard

Allow nohup background running

Open maaaaz opened this issue 11 months ago • 4 comments

Hello there,

Currently, on Linux, if you try to run ODD in an unattended way, for instance with nohup, it does not work at all, the following message is returned:

Console input is redirect, maybe it is run inside another host. This could mean that no input will be send/processed.
2025-01-10 20:01:43.705 [WRN] Console input is redirect, maybe it is run inside another host. This could mean that no input will be send/processed.
2025-01-10 20:01:43.751 [ERR] Error processing action
System.UnauthorizedAccessException: Access to the path is denied.
 ---> System.IO.IOException: Bad file descriptor
   --- End of inner exception stack trace ---
   at Interop.ThrowExceptionForIoErrno(ErrorInfo, String, Boolean)
   at Interop.CheckIo(Int64, String , Boolean )
   at Interop.CheckIo(Int32, String , Boolean )
   at System.ConsolePal.Read(SafeFileHandle, Span`1)
   at System.ConsolePal.UnixConsoleStream.Read(Span`1)
   at System.IO.ConsoleStream.Read(Byte[], Int32, Int32)
   at System.IO.StreamReader.ReadBuffer()
   at System.IO.StreamReader.Read()
   at System.IO.SyncTextReader.Read()
   at System.Console.Read()
   at OpenDirectoryDownloader.Command.ProcessConsoleInput(OpenDirectoryIndexer openDirectoryIndexer)
Unhandled exception. System.UnauthorizedAccessException: Access to the path is denied.
 ---> System.IO.IOException: Bad file descriptor
   --- End of inner exception stack trace ---
   at Interop.ThrowExceptionForIoErrno(ErrorInfo, String, Boolean)
   at Interop.CheckIo(Int64, String , Boolean )
   at Interop.CheckIo(Int32, String , Boolean )
   at System.ConsolePal.Read(SafeFileHandle, Span`1)
   at System.ConsolePal.UnixConsoleStream.Read(Span`1)
   at System.IO.ConsoleStream.Read(Byte[], Int32, Int32)
   at System.IO.StreamReader.ReadBuffer()
   at System.IO.StreamReader.Read()
   at System.IO.SyncTextReader.Read()
   at System.Console.Read()
   at OpenDirectoryDownloader.Command.ProcessConsoleInput(OpenDirectoryIndexer openDirectoryIndexer)
   at OpenDirectoryDownloader.Program.Main(String[] args)
   at OpenDirectoryDownloader.Program.<Main>(String[] args)

Could you allow such capacity ?

Cheers!

maaaaz avatar Jan 10 '25 19:01 maaaaz

Hi,

I have never heard of this. How do you start/use it? What is the purpose?

KoalaBear84 avatar Jan 10 '25 19:01 KoalaBear84

You use it like this nohup <command> & in order to have the command being run without any shell attached. https://www.digitalocean.com/community/tutorials/nohup-command-in-linux

It is usually used for long-running tasks.

maaaaz avatar Jan 10 '25 22:01 maaaaz

I've tried reproducing it, but I can't :)

koalabear@DESKTOP-XX:~$ nohup ./OpenDirectoryDownloader --url https://www.falsedoor.com/txt/ &
[1] 27642
koalabear@DESKTOP-XX:~$ nohup: ignoring input and appending output to 'nohup.out'
koalabear@DESKTOP-XX:~$

koalabear@DESKTOP-XXX:~$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

What can I try next?

KoalaBear84 avatar Feb 15 '25 11:02 KoalaBear84

Hello there,

Thanks for trying !

I still can reproduce this:


$ ps -p $$
    PID TTY          TIME CMD
  12345 pts/3    00:00:00 bash

$ bash --version
GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.1 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

$ wget -nv "https://github.com/KoalaBear84/OpenDirectoryDownloader/releases/download/v3.3.0.3/OpenDirectoryDownloader-3.3.0.3-linux-x64-self-contained.zip"

$ nohup ./OpenDirectoryDownloader --url https://www.falsedoor.com/txt/ &
nohup: ignoring input and appending output to 'nohup.out'

[I PRESS ENTER TWICE HERE]

[2]-  Aborted                 (core dumped) nohup ./OpenDirectoryDownloader --url https://www.falsedoor.com/txt/

$ cat ./nohup.out
Started with PID 99199
URL specified: https://www.falsedoor.com/txt/
Started indexing!
┌─────────────────────────────────────────────────────────────────────────┐
│ KoalaBear84/OpenDirectoryDownloader v3.3.0.3                            │
├─────────────────────────────────────────────────────────────────────────┤
│ Press I for info (this)                                                 │
│ Press S for statistics                                                  │
│ Press T for thread info                                                 │
│ Press U for Save TXT                                                    │
│ Press J for Save JSON                                                   │
├─────────────────────────────────────────────────────────────────────────┤
│ Press ESC or X to EXIT                                                  │
└─────────────────────────────────────────────────────────────────────────┘

Console input is redirect, maybe it is run inside another host. This could mean that no input will be send/processed.
2025-02-22 13:51:06.159 [WRN] Console input is redirect, maybe it is run inside another host. This could mean that no input will be send/processed.
2025-02-22 13:51:06.184 [ERR] Error processing action
System.UnauthorizedAccessException: Access to the path is denied.
 ---> System.IO.IOException: Bad file descriptor
   --- End of inner exception stack trace ---
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError)
   at Interop.CheckIo(Int64 result, String path, Boolean isDirError)
   at Interop.CheckIo(Int32 result, String path, Boolean isDirError)
   at System.ConsolePal.Read(SafeFileHandle fd, Span`1 buffer)
   at System.ConsolePal.UnixConsoleStream.Read(Span`1 buffer)
   at System.IO.ConsoleStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.StreamReader.ReadBuffer()
   at System.IO.StreamReader.Read()
   at System.IO.SyncTextReader.Read()
   at System.Console.Read()
   at OpenDirectoryDownloader.Command.ProcessConsoleInput(OpenDirectoryIndexer openDirectoryIndexer) in /home/runner/work/OpenDirectoryDownloader/OpenDirectoryDownloader/src/OpenDirectoryDownloader/Command.cs:line 59
Unhandled exception. System.UnauthorizedAccessException: Access to the path is denied.
 ---> System.IO.IOException: Bad file descriptor
   --- End of inner exception stack trace ---
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError)
   at Interop.CheckIo(Int64 result, String path, Boolean isDirError)
   at Interop.CheckIo(Int32 result, String path, Boolean isDirError)
   at System.ConsolePal.Read(SafeFileHandle fd, Span`1 buffer)
   at System.ConsolePal.UnixConsoleStream.Read(Span`1 buffer)
   at System.IO.ConsoleStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.StreamReader.ReadBuffer()
   at System.IO.StreamReader.Read()
   at System.IO.SyncTextReader.Read()
   at System.Console.Read()
   at OpenDirectoryDownloader.Command.ProcessConsoleInput(OpenDirectoryIndexer openDirectoryIndexer) in /home/runner/work/OpenDirectoryDownloader/OpenDirectoryDownloader/src/OpenDirectoryDownloader/Command.cs:line 59
   at OpenDirectoryDownloader.Program.Main(String[] args) in /home/runner/work/OpenDirectoryDownloader/OpenDirectoryDownloader/src/OpenDirectoryDownloader/Program.cs:line 157
   at OpenDirectoryDownloader.Program.<Main>(String[] args)

Watch out:

  • I am using the selfcontained version above.
  • try to press "Enter" when you see nohup: ignoring input and appending output to 'nohup.out' as the coredump does not come without interaction.

And by the way, I also just reproduced it with the current latest https://github.com/KoalaBear84/OpenDirectoryDownloader/releases/download/v3.4.0.2/OpenDirectoryDownloader-3.4.0.2-linux-x64-self-contained.zip

Cheers!

maaaaz avatar Feb 22 '25 13:02 maaaaz