[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, 19 Mar 2021 16:27:07 -0700 |
Hi all,
Sorry for the delay with my follow-up; but I wanted to ensure my fix
was actually working.
It turns out I have ssh commands in my script that work without a
hitch the vast majority of the time; but I guess occasionally there is
an issue. I change the ssh commands to include the -n option and I
haven't had the script stop in almost a week.
Regards,
--
Mun
On Fri, Feb 26, 2021 at 10:54 PM Mun <mjelists@gmail.com> wrote:
>
> 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.
- Re: For some reason my background script keeps stopping,
Mun <=