help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: For some reason my background script keeps stopping


From: Mun
Subject: Re: For some reason my background script keeps stopping
Date: Fri, 26 Feb 2021 22:54:30 -0800

Hi Eduardo,

Thank you for the excellent suggestions.  I will give them a try and
see if I can root cause the issue.  I will report back when I have
additional information.

Best regards,

-- 
Mun

On Fri, Feb 26, 2021 at 5:13 PM Eduardo Bustamante <dualbus@gmail.com> wrote:
>
> On Fri, Feb 26, 2021 at 4:53 PM Mun <mjelists@gmail.com> wrote:
> (...)
> > I'm wondering if anyone knows why the script is entering the Stopped
> > state when it doesn't require input from the user?
>
> It's hard to know without seeing the whole script. It should stop if
> it tries to read from the terminal. Try inspecting the running process
> with "lsof" to ensure that no open file descriptors are pointing to
> the terminal, and if there are any, make sure you close them at the
> beginning of your script, or redirect to/from /dev/null
>
> e.g
>
>   exec </dev/null 1>&0 2>&1
>
>
> > Also, is there any way for me to debug this further to know why it has
> > stopped?  Is the -x flag my only option?
>
> You could try tracing it with "strace" if you're in a Linux system,
> something like:
>
>   strace -f -p SCRIPTS_PID -v -o trace.log
>
> That should tell you what's causing it to stop.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]