Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Commands started by nohup cannot continue to run after the terminal is closed.

101 views
Skip to first unread message

hongy...@gmail.com

unread,
Feb 1, 2021, 9:08:05 PM2/1/21
to
On Ubuntu 20.04, I want to start Google Chrome in daemon mode which will survive terminal close and tried the following methods:

1. nohup google-chrome --no-startup-window >/dev/null 2>&1 &
2. ( google-chrome --no-startup-window >/dev/null 2>&1 & )
3. google-chrome --no-startup-window >/dev/null 2>&1 & disown
4. setsid google-chrome --no-startup-window >/dev/null 2>&1 &
5. screen -dm google-chrome --no-startup-window >/dev/null 2>&1 &

It seems that all methods except 1 can do the trick. Any hints for this problem?

Regards,
HY

Bit Twister

unread,
Feb 2, 2021, 5:54:51 AM2/2/21
to
I have no experience with google-chrome, but I find it handy to always
supply the display argument along with $DISPLAY for any apps using $DISPLAY
in nohup script operations. Command example:

$ grep display xy*
xyahoo: xterm -title "$_nstlp $_user" -display $DISPLAY -geom 30x4+778+734 \




Kenny McCormack

unread,
Feb 2, 2021, 6:14:37 AM2/2/21
to
In article <slrns1ibrl.6...@wb.home.test>,
Bit Twister <BitTw...@mouse-potato.com> wrote:
>On Mon, 1 Feb 2021 18:08:01 -0800 (PST), hongy...@gmail.com wrote:
>> On Ubuntu 20.04, I want to start Google Chrome in daemon mode which will
>survive terminal close and tried the following methods:
>>
>> 1. nohup google-chrome --no-startup-window >/dev/null 2>&1 &
>> 2. ( google-chrome --no-startup-window >/dev/null 2>&1 & )
>> 3. google-chrome --no-startup-window >/dev/null 2>&1 & disown
>> 4. setsid google-chrome --no-startup-window >/dev/null 2>&1 &
>> 5. screen -dm google-chrome --no-startup-window >/dev/null 2>&1 &
>>
>> It seems that all methods except 1 can do the trick. Any hints for this problem?
>
>I have no experience with google-chrome, but I find it handy to always
>supply the display argument along with $DISPLAY for any apps using $DISPLAY
>in nohup script operations. Command example:

This thread has no basis. It'd be like saying in any other context (e.g.,
a non-computer context, like, say, making chicken soup): I have 4 methods
that work fine and one that doesn't. What should I do?

--
People sleep peaceably in their beds at night only because rough
men stand ready to do violence on their behalf.

George Orwell

Janis Papanagnou

unread,
Feb 2, 2021, 6:51:12 AM2/2/21
to
So avoid method 1 if it "does not work", "will not do the trick", etc.

> Any hints for this problem?

What problem? (You haven't told us of any existing problem.)

General remarks...

I used 3. in the past if I wanted to disown a background job *ex post*;
I'd not use 3. as a general mechanism because it is depending on a/the
shell built-in 'disown'.

I generally use 2. because it doesn't rely on external programs and it
worked since decades as a standard mechanism within the standard (and
older) shell(s). It directly reflects the orphaned processes in Unix
by shell syntax. An equivalent approach is used in system programming
if implementing a demon application (fork/exec'ing an intermediate
process that gets closed after fork/exec'ing the demon process).

Janis

>
> Regards,
> HY
>

hongy...@gmail.com

unread,
Feb 2, 2021, 8:04:45 AM2/2/21
to
Why do you set such a strange geometry size/ranger for your display device? See the corresponding values as shown below for my case:

werner@X10DAi:~$ xwininfo -root | grep geo
-geometry 1920x1080+0+0
werner@X10DAi:~$ xrandr |grep 'connected primary'
HDMI-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 598mm x 336mm

Regards,
HY

hongy...@gmail.com

unread,
Feb 2, 2021, 8:05:32 AM2/2/21
to
On Tuesday, February 2, 2021 at 7:51:12 PM UTC+8, Janis Papanagnou wrote:
> On 02.02.2021 03:08, hongy...@gmail.com wrote:
> > On Ubuntu 20.04, I want to start Google Chrome in daemon mode which will survive terminal close and tried the following methods:
> >
> > 1. nohup google-chrome --no-startup-window >/dev/null 2>&1 &
> > 2. ( google-chrome --no-startup-window >/dev/null 2>&1 & )
> > 3. google-chrome --no-startup-window >/dev/null 2>&1 & disown
> > 4. setsid google-chrome --no-startup-window >/dev/null 2>&1 &
> > 5. screen -dm google-chrome --no-startup-window >/dev/null 2>&1 &
> >
> > It seems that all methods except 1 can do the trick.
> So avoid method 1 if it "does not work", "will not do the trick", etc.
> > Any hints for this problem?
> What problem? (You haven't told us of any existing problem.)
>
> General remarks...
>
> I used 3. in the past if I wanted to disown a background job *ex post*;

What do you mean by saying *ex post*?

John McCue

unread,
Feb 2, 2021, 8:57:51 AM2/2/21
to
hongy...@gmail.com <hongy...@gmail.com> wrote:
> On Ubuntu 20.04, I want to start Google Chrome in daemon mode which
> will survive terminal close and tried the following methods:
<snip>

LMGTFY, seems you ran into a feature of systemd, see

https://unix.stackexchange.com/questions/420594/why-process-killed-with-nohup

On Linux these days, seems to get nohup working you need
to do what is suggested above and/or use setsid(1).

Please see this link for posting to usenet, it makes it
hard for people using 'real' news readers to read and
reply to your posts.

http://www.mugsy.org/asa_faq/getting_along/usenet.shtml


> Regards,
> HY

Regards

Bit Twister

unread,
Feb 2, 2021, 9:25:30 AM2/2/21
to
On Tue, 2 Feb 2021 05:04:42 -0800 (PST), hongy...@gmail.com wrote:
> On Tuesday, February 2, 2021 at 6:54:51 PM UTC+8, Bit Twister wrote:
>> On Mon, 1 Feb 2021 18:08:01 -0800 (PST), hongy...@gmail.com wrote:


>> I have no experience with google-chrome, but I find it handy to always
>> supply the display argument along with $DISPLAY for any apps using $DISPLAY
>> in nohup script operations. Command example:
>>
>> $ grep display xy*
>> xyahoo: xterm -title "$_nstlp $_user" -display $DISPLAY -geom 30x4+778+734 \
>
> Why do you set such a strange geometry size/ranger for your display device?

I have separate unix accounts for each off system accounts needing an
id/pw. The small xyahoo terminal was just for the automagical login
to that account and launches thunderbird which ignores terminal size.
Upon thunderbird exit, everything closes/exits.

Bit Twister

unread,
Feb 2, 2021, 9:36:38 AM2/2/21
to
I have warned him a few times that subject matter experts may not
bother to reply if they have to reformat it to conform to Usenet
guidelines when they had something to help.

I been thinking about putting him my score file.

Janis Papanagnou

unread,
Feb 2, 2021, 11:39:31 AM2/2/21
to
On 02.02.2021 14:05, hongy...@gmail.com wrote:
> On Tuesday, February 2, 2021 at 7:51:12 PM UTC+8, Janis Papanagnou wrote:
>>
>> I used 3. in the past if I wanted to disown a background job *ex post*;
>
> What do you mean by saying *ex post*?

"later"
(without any intended timely coupling of the process and its disowning)

If I want to instantiate a demon process I do ( cmd & )
If I want a formerly started background process cmd &
later disowned, I do at any time later, e.g., disown %1

Janis

hongy...@gmail.com

unread,
Feb 2, 2021, 8:28:57 PM2/2/21
to
What's the meaning of *%1*? I checked the built-in help of disown and can't find the related notes about it as shown below:

$ help disown
disown: disown [-h] [-ar] [jobspec ... | pid ...]
Remove jobs from current shell.

Removes each JOBSPEC argument from the table of active jobs. Without
any JOBSPECs, the shell uses its notion of the current job.

Options:
-a remove all jobs if JOBSPEC is not supplied
-h mark each JOBSPEC so that SIGHUP is not sent to the job if the
shell receives a SIGHUP
-r remove only running jobs

Exit Status:
Returns success unless an invalid option or JOBSPEC is given.


> Janis

Janis Papanagnou

unread,
Feb 2, 2021, 9:29:56 PM2/2/21
to
On 03.02.2021 02:28, hongy...@gmail.com wrote:
> On Wednesday, February 3, 2021 at 12:39:31 AM UTC+8, Janis Papanagnou wrote:
>> later disowned, I do at any time later, e.g., disown %1
>
> What's the meaning of *%1*? I checked the built-in help of disown and can't find the related notes about it as shown below:

Search the shell manual for Job Control.

Janis

Keith Thompson

unread,
Feb 2, 2021, 10:16:26 PM2/2/21
to
Or for "jobspec", the term used in the output of "help disown".

--
Keith Thompson (The_Other_Keith) Keith.S.T...@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */

hongy...@gmail.com

unread,
Feb 2, 2021, 11:14:41 PM2/2/21
to
Thanks. Got it as following:

$ man bash |grep -A2 ' %1 '
Simply naming a job can be used to bring it into the foreground: %1 is a synonym for ``fg %1'', bringing
job 1 from the background into the foreground. Similarly, ``%1 &'' resumes job 1 in the background,
equivalent to ``bg %1''.


>
> Janis

hongy...@gmail.com

unread,
Feb 2, 2021, 11:17:40 PM2/2/21
to
On Wednesday, February 3, 2021 at 11:16:26 AM UTC+8, Keith Thompson wrote:
> Janis Papanagnou <janis_pa...@hotmail.com> writes:
> > On 03.02.2021 02:28, hongy...@gmail.com wrote:
> >> On Wednesday, February 3, 2021 at 12:39:31 AM UTC+8, Janis Papanagnou wrote:
> >>> later disowned, I do at any time later, e.g., disown %1
> >>
> >> What's the meaning of *%1*? I checked the built-in help of disown and
> >> can't find the related notes about it as shown below:
> >
> > Search the shell manual for Job Control.
> Or for "jobspec", the term used in the output of "help disown".

Yep. Thanks again. See the following for the detailed info:

$ man bash |grep -im1 'JOBSPEC'
tion (jobspec). Job number n may be referred to as %n. A job may also be referred to using a prefix of


hongy...@gmail.com

unread,
Feb 2, 2021, 11:20:24 PM2/2/21
to
On Wednesday, February 3, 2021 at 12:39:31 AM UTC+8, Janis Papanagnou wrote:
> On 02.02.2021 14:05, hongy...@gmail.com wrote:
> > On Tuesday, February 2, 2021 at 7:51:12 PM UTC+8, Janis Papanagnou wrote:
> >>
> >> I used 3. in the past if I wanted to disown a background job *ex post*;
> >
> > What do you mean by saying *ex post*?
> "later"
> (without any intended timely coupling of the process and its disowning)
>
> If I want to instantiate a demon process I do ( cmd & )

But I find this method can't let the process survive the ssh logout/disconnection, while the other methods do. See the discussion at this website: <https://www.tecmint.com/keep-remote-ssh-sessions-running-after-disconnection/>.

Janis Papanagnou

unread,
Feb 3, 2021, 2:57:23 AM2/3/21
to
On 03.02.2021 05:20, hongy...@gmail.com wrote:
> On Wednesday, February 3, 2021 at 12:39:31 AM UTC+8, Janis Papanagnou wrote:
>> On 02.02.2021 14:05, hongy...@gmail.com wrote:
>>> On Tuesday, February 2, 2021 at 7:51:12 PM UTC+8, Janis Papanagnou wrote:
>>>>
>>>> I used 3. in the past if I wanted to disown a background job *ex post*;
>>>
>>> What do you mean by saying *ex post*?
>> "later"
>> (without any intended timely coupling of the process and its disowning)
>>
>> If I want to instantiate a demon process I do ( cmd & )
>
> But I find this method can't let the process survive the ssh logout/disconnection, while the other methods do. See the discussion at this website: <https://www.tecmint.com/keep-remote-ssh-sessions-running-after-disconnection/>.

Personally I find it more a problem that ( cmd & ) cannot brew my
morning coffee.

IOW; specify your requirements in your post and get the fitting best
answers.

WRT your website link above; look it up yourself and read the given
answers if they already addressed your question. (We've already been
here with other threads of yours.) Or specify your issue here in CUS
if the answer on that website is not satisfying.

Janis
0 new messages