Do I really need to use nohup? [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite













This question already has an answer here:



  • Why do we daemonize processes? [closed]

    1 answer



I would like to let run my script on background on my server. I red about nohup. I have my script.py. I run it like this:



python3 script.py&


It runs on background even when I close terminal. The script write numbers to file /tmp/aaa.txt every second, started from 0. I disconnect from server and reconnect to it and sow that there is numbers over 3000 (over 50 minutes). So my question is, do I really need to use nohup? If yes/no why?



# hostnamectl 
Static hostname: my-server
Icon name: computer-vm
Chassis: vm
Machine ID: XXXX
Boot ID: XXXX
Virtualization: vmware
Operating System: Ubuntu 16.04.3 LTS
Kernel: Linux 4.4.0-116-generic
Architecture: x86-64


My script script.py:



import time

i = 0

while True:
f = open('aaa.txt', 'a+')
f.write('Doing somethign: 0n'.format(i))
f.close()
i = i + 1
time.sleep(1)






share|improve this question













marked as duplicate by sebasth, schily, slm♦ linux
Users with the  linux badge can single-handedly close linux questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Jun 25 at 22:29


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1




    You don't need to use nohup if the script ignores the HUP signal. Does it?
    – Kusalananda
    Jun 25 at 20:51










  • I do not configure anything, how can I check it? I added output of my script.py.
    – dorinand
    Jun 25 at 20:54














up vote
0
down vote

favorite













This question already has an answer here:



  • Why do we daemonize processes? [closed]

    1 answer



I would like to let run my script on background on my server. I red about nohup. I have my script.py. I run it like this:



python3 script.py&


It runs on background even when I close terminal. The script write numbers to file /tmp/aaa.txt every second, started from 0. I disconnect from server and reconnect to it and sow that there is numbers over 3000 (over 50 minutes). So my question is, do I really need to use nohup? If yes/no why?



# hostnamectl 
Static hostname: my-server
Icon name: computer-vm
Chassis: vm
Machine ID: XXXX
Boot ID: XXXX
Virtualization: vmware
Operating System: Ubuntu 16.04.3 LTS
Kernel: Linux 4.4.0-116-generic
Architecture: x86-64


My script script.py:



import time

i = 0

while True:
f = open('aaa.txt', 'a+')
f.write('Doing somethign: 0n'.format(i))
f.close()
i = i + 1
time.sleep(1)






share|improve this question













marked as duplicate by sebasth, schily, slm♦ linux
Users with the  linux badge can single-handedly close linux questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Jun 25 at 22:29


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1




    You don't need to use nohup if the script ignores the HUP signal. Does it?
    – Kusalananda
    Jun 25 at 20:51










  • I do not configure anything, how can I check it? I added output of my script.py.
    – dorinand
    Jun 25 at 20:54












up vote
0
down vote

favorite









up vote
0
down vote

favorite












This question already has an answer here:



  • Why do we daemonize processes? [closed]

    1 answer



I would like to let run my script on background on my server. I red about nohup. I have my script.py. I run it like this:



python3 script.py&


It runs on background even when I close terminal. The script write numbers to file /tmp/aaa.txt every second, started from 0. I disconnect from server and reconnect to it and sow that there is numbers over 3000 (over 50 minutes). So my question is, do I really need to use nohup? If yes/no why?



# hostnamectl 
Static hostname: my-server
Icon name: computer-vm
Chassis: vm
Machine ID: XXXX
Boot ID: XXXX
Virtualization: vmware
Operating System: Ubuntu 16.04.3 LTS
Kernel: Linux 4.4.0-116-generic
Architecture: x86-64


My script script.py:



import time

i = 0

while True:
f = open('aaa.txt', 'a+')
f.write('Doing somethign: 0n'.format(i))
f.close()
i = i + 1
time.sleep(1)






share|improve this question














This question already has an answer here:



  • Why do we daemonize processes? [closed]

    1 answer



I would like to let run my script on background on my server. I red about nohup. I have my script.py. I run it like this:



python3 script.py&


It runs on background even when I close terminal. The script write numbers to file /tmp/aaa.txt every second, started from 0. I disconnect from server and reconnect to it and sow that there is numbers over 3000 (over 50 minutes). So my question is, do I really need to use nohup? If yes/no why?



# hostnamectl 
Static hostname: my-server
Icon name: computer-vm
Chassis: vm
Machine ID: XXXX
Boot ID: XXXX
Virtualization: vmware
Operating System: Ubuntu 16.04.3 LTS
Kernel: Linux 4.4.0-116-generic
Architecture: x86-64


My script script.py:



import time

i = 0

while True:
f = open('aaa.txt', 'a+')
f.write('Doing somethign: 0n'.format(i))
f.close()
i = i + 1
time.sleep(1)




This question already has an answer here:



  • Why do we daemonize processes? [closed]

    1 answer









share|improve this question












share|improve this question




share|improve this question








edited Jun 25 at 20:53
























asked Jun 25 at 20:46









dorinand

313213




313213




marked as duplicate by sebasth, schily, slm♦ linux
Users with the  linux badge can single-handedly close linux questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Jun 25 at 22:29


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by sebasth, schily, slm♦ linux
Users with the  linux badge can single-handedly close linux questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Jun 25 at 22:29


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









  • 1




    You don't need to use nohup if the script ignores the HUP signal. Does it?
    – Kusalananda
    Jun 25 at 20:51










  • I do not configure anything, how can I check it? I added output of my script.py.
    – dorinand
    Jun 25 at 20:54












  • 1




    You don't need to use nohup if the script ignores the HUP signal. Does it?
    – Kusalananda
    Jun 25 at 20:51










  • I do not configure anything, how can I check it? I added output of my script.py.
    – dorinand
    Jun 25 at 20:54







1




1




You don't need to use nohup if the script ignores the HUP signal. Does it?
– Kusalananda
Jun 25 at 20:51




You don't need to use nohup if the script ignores the HUP signal. Does it?
– Kusalananda
Jun 25 at 20:51












I do not configure anything, how can I check it? I added output of my script.py.
– dorinand
Jun 25 at 20:54




I do not configure anything, how can I check it? I added output of my script.py.
– dorinand
Jun 25 at 20:54










1 Answer
1






active

oldest

votes

















up vote
2
down vote













The action is controlled by the bash option huponexit . Check to see what it is set to, if set to "on" it will send a sighup to all child processes on exit. If not, it should keep running.



$ shopt | grep huponexit
huponexit off





share|improve this answer





















  • Hi, I can see the same output as you have, thank you for your explanation.
    – dorinand
    Jun 25 at 21:41

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote













The action is controlled by the bash option huponexit . Check to see what it is set to, if set to "on" it will send a sighup to all child processes on exit. If not, it should keep running.



$ shopt | grep huponexit
huponexit off





share|improve this answer





















  • Hi, I can see the same output as you have, thank you for your explanation.
    – dorinand
    Jun 25 at 21:41














up vote
2
down vote













The action is controlled by the bash option huponexit . Check to see what it is set to, if set to "on" it will send a sighup to all child processes on exit. If not, it should keep running.



$ shopt | grep huponexit
huponexit off





share|improve this answer





















  • Hi, I can see the same output as you have, thank you for your explanation.
    – dorinand
    Jun 25 at 21:41












up vote
2
down vote










up vote
2
down vote









The action is controlled by the bash option huponexit . Check to see what it is set to, if set to "on" it will send a sighup to all child processes on exit. If not, it should keep running.



$ shopt | grep huponexit
huponexit off





share|improve this answer













The action is controlled by the bash option huponexit . Check to see what it is set to, if set to "on" it will send a sighup to all child processes on exit. If not, it should keep running.



$ shopt | grep huponexit
huponexit off






share|improve this answer













share|improve this answer



share|improve this answer











answered Jun 25 at 21:32









Joe M

5964




5964











  • Hi, I can see the same output as you have, thank you for your explanation.
    – dorinand
    Jun 25 at 21:41
















  • Hi, I can see the same output as you have, thank you for your explanation.
    – dorinand
    Jun 25 at 21:41















Hi, I can see the same output as you have, thank you for your explanation.
– dorinand
Jun 25 at 21:41




Hi, I can see the same output as you have, thank you for your explanation.
– dorinand
Jun 25 at 21:41


Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay