Do I really need to use nohup? [duplicate]
Clash 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)
linux ubuntu nohup python3
marked as duplicate by sebasth, schily, slmâ¦
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.
add a comment |Â
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)
linux ubuntu nohup python3
marked as duplicate by sebasth, schily, slmâ¦
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 usenohup
if the script ignores theHUP
signal. Does it?
â Kusalananda
Jun 25 at 20:51
I do not configure anything, how can I check it? I added output of myscript.py
.
â dorinand
Jun 25 at 20:54
add a comment |Â
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)
linux ubuntu nohup python3
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
linux ubuntu nohup python3
edited Jun 25 at 20:53
asked Jun 25 at 20:46
dorinand
313213
313213
marked as duplicate by sebasth, schily, slmâ¦
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â¦
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 usenohup
if the script ignores theHUP
signal. Does it?
â Kusalananda
Jun 25 at 20:51
I do not configure anything, how can I check it? I added output of myscript.py
.
â dorinand
Jun 25 at 20:54
add a comment |Â
1
You don't need to usenohup
if the script ignores theHUP
signal. Does it?
â Kusalananda
Jun 25 at 20:51
I do not configure anything, how can I check it? I added output of myscript.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
add a comment |Â
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
Hi, I can see the same output as you have, thank you for your explanation.
â dorinand
Jun 25 at 21:41
add a comment |Â
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
Hi, I can see the same output as you have, thank you for your explanation.
â dorinand
Jun 25 at 21:41
add a comment |Â
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
Hi, I can see the same output as you have, thank you for your explanation.
â dorinand
Jun 25 at 21:41
add a comment |Â
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
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
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
add a comment |Â
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
add a comment |Â
1
You don't need to use
nohup
if the script ignores theHUP
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