Skip to main content

Questions tagged [disown]

Question related to the "disown" builtin command from shells like bash, zsh or ksh.

Filter by
Sorted by
Tagged with
0 votes
0 answers
120 views

How to reown a process?

when i run this script with a shortcut(sxhkd): #!/bin/sh MUSIC_DIR="$HOME/music" songs=$(ls "$MUSIC_DIR") filename=$( echo -e "random\n$songs" | dmenu -l 30 -i -p &...
white-hat-er's user avatar
1 vote
2 answers
361 views

How to disown a command in the busybox shell?

I'm trying to write a quick-and-dirty shell script daemon to run on a home router that has a busybox shell, which doesn't support disown. Is there any way to do either of the following? Run a command ...
joshlf's user avatar
  • 375
3 votes
1 answer
175 views

Running a program outside of terminal

I'm trying to bring up a terminal to interactively ask for a file, and open it using a GUI program: foot /bin/sh -c 'file=`fzf`;(setsid xdg-open "$file" &)' I'm using setsid, because ...
Remko's user avatar
  • 133
0 votes
1 answer
927 views

why websocat or wscat in background with nohup, disown, bg, &, &! don't work

The question is about running a bash script in background with the ability to logout and the process to continue. The issue is that websocat and wscat don't like when I close the terminal or logout.......
John R's user avatar
  • 115
0 votes
2 answers
805 views

When a program/process is started in bash without nohup, is it later possible to let this program run even after the shell/terminal is closed

When a program/process is started in bash WITHOUT nohup, is it later possible(do something further) to let this program run even after the shell/terminal is closed. Here is a great discussion on ...
samshers's user avatar
  • 688
1 vote
0 answers
525 views

process is still interrupted with closing ssh connection after disown

After running a process, then using: ctrl+z bg disown [-h] Closing the connection still results in interrupting the running process.
cookiemonster's user avatar
0 votes
0 answers
835 views

NOHUP stopped working

I've been using nohup for years on my server without any issue. Suddenly today it stopped working and the process ends as soon as I exit SSH. I have multiple accounts on this server and the problem is ...
Ray's user avatar
  • 101
0 votes
1 answer
798 views

`& disown` and `setsid` not working with ssh! They launch an `(sd-pam)` process, which is not working

I'm trying to reboot the server after a specified time. If logged in on the server this can be achieved with a command like this: sleep 10 && reboot To make this command stay alive (without ...
miu's user avatar
  • 265
1 vote
1 answer
2k views

String literal inside backticks in bash

I would like to create a process that runs in the background and waits for 2 seconds and prints a literal. I'm trying to do `sleep 2 && echo "hello"` & However, it's trying to ...
Tobias Feil's user avatar
1 vote
1 answer
2k views

Why does my process terminate upon log out despite nohup and disown?

I have an executable (a server made with Unity) which I want to continue to run after I log out. All the interwebs say that I should be able to accomplish this with nohup or disown or both. But it ...
Joe Strout's user avatar
0 votes
1 answer
195 views

Get the exit code before disown

I am executing a command using timeout in the following way that waits for seconds and then exits timeout -k 1 10 <command> &> error.log & disown % However, I've realized that since ...
user782400's user avatar
1 vote
0 answers
1k views

Completely disown background process

I have a bg process disowned like so: (idea "$code_home/jenkins-jobs" ) & disown The problem is it will start writing its stdout/stderr to the terminal from which I launched it. I would have ...
Alexander Mills's user avatar
1 vote
2 answers
1k views

Send process to background and disown and exit the terminal (& and && operator clash in zsh)

I need to run a process in the background and then exit the current terminal. The following command results in error: > google-chrome-stable &! && exit zsh: parse error near '&&...
Ian Melendez's user avatar
3 votes
1 answer
1k views

How does bash's disown work?

On a Linux system, the bash builtin command disown can be used to remove jobs from the current session. How does bash implement this feature? Is setsid() used here, and if so, how does bash trigger ...
Vince.Wu's user avatar
  • 131
1 vote
3 answers
5k views

Proper way to start a background process

I am just trying to start up a basic node.js server on a remote machine in a ssh session. This seems to work: nohup node server/server.js & disown Maybe I don't need nohup? what's the "official"...
Alexander Mills's user avatar
2 votes
0 answers
54 views

Shell: short version of `<application> & disown; exit` for replacing the terminal with a gui application

On a tiling window manager starting a gui application from the terminal emulator leaves the terminal open alongside the newly started window. A solution for this is $ <application> & ...
Matthias Brandt's user avatar
3 votes
2 answers
2k views

Run script with user input and then disconnect job and run in background

So I have a bash script that first asks for a series of three variables from the user. I then want the script to run in the background disconnected from my session, so that when I cut the connection ...
Pyrodancer123's user avatar
3 votes
1 answer
2k views

How to start and disown a process in a single line?

I noticed that many times I need to start a process and disown it immediately. I trying to achieve this in a single line. Any ideas how to do it?
HRK's user avatar
  • 71
-2 votes
1 answer
293 views

Why does `disown -h` make chromium-browser survive closing its terminal emulator tab?

In Why is chromium-browser killed when I close the terminal despite nohup?, I wrote that in a Terminal emulator tab, I ran $ nohup chromium-browser & When I close the terminal tab, chromium-...
Tim's user avatar
  • 103k
25 votes
2 answers
9k views

Do `disown -h` and `nohup` work effectively the same?

disown causes a shell not to send SIGHUP to its disowned job when the shell terminates, and removes the disowned job from the shell's job control. Is the first the result of the second? In other ...
Tim's user avatar
  • 103k
3 votes
2 answers
13k views

How to disown a process from another shell

To avoid a process to stop when exiting the shell, you can launch the command via nohup or screen. It is also possible to disown an existing process with following commands: mycommand # Press CTRL-Z ...
Golgot's user avatar
  • 141
2 votes
4 answers
6k views

Disowning child from parent process

If $PID_PARENT launched $PID_CHILD, how can I detach (disown?) $PID_CHILD from $PID_PARENT so that, when I kill $PID_PARENT, $PID_CHILD keeps running like nothing happened? Concretely, my $PID_PARENT ...
amphibient's user avatar
  • 12.6k
1 vote
1 answer
1k views

In bash, a process group is a job if and only if ...?

Here are two cases when a process group in an interactive shell isn't a job of the shell: $ sleep 100 & [1] 16081 $ jobs [1]+ Running sleep 100 & $ disown %1 $ jobs $ and $ ...
Tim's user avatar
  • 103k
2 votes
1 answer
4k views

How do I kill a process created with disown?

I wanted to keep a program, redshift, running in the background instead of having to keep a terminal constantly opened. I learned from a forum that I can do this by typing $ redshift & followed ...
Ken Chester's user avatar
4 votes
2 answers
1k views

How to open the gnome-terminal within the gnome-terminal without disowning

If I open the gnome-terminal within the gnome-terminal, the newly created terminal automatically gets disowned from the parent. Some other applications do not. How to simulate that behavior? How to ...
DasOhmoff San's user avatar
2 votes
1 answer
1k views

Why do I still receive stdout or stderr after disowning a process?

I started QEMU and immediately disowned it, but still receive output onto my shell: aburk@aburk:~$ su Password: [root@aburk aburk]# QEMU_AUDIO_DRV="pa" QEMU_PA_SERVER="/run/user/1000/pulse/native" ...
Austin Burk's user avatar
0 votes
1 answer
67 views

Terminal that is set to close .. takes the disowned gui_app with itself

a new terminal opens up and runs the script. terminal -e "/script" script runs a gui_app, disowns it. sleeps 4 seconds. #!/bin/sh /gui_app & disown sleep 4 after sleep.. terminal ...
user avatar
0 votes
1 answer
71 views

disown : unable to stop stderr s [duplicate]

Problem: Even with dev null and disown.. web browser is still reporting errors to the terminal it launched from of. web_browser < /dev/null > /dev/null 1>&2 & disown
user avatar
1 vote
1 answer
84 views

" web_browser & disown " : still see-ing data

terminal, run web browser: web_browser & disown web browser opens fine. it seems to be disowned by the terminal. but as I use the web browser... to surf the web.. I begin to see the web ...
user avatar
3 votes
1 answer
252 views

What is the behavior of a disowned process over SSH writing to stdout when the SSH session is lost?

I have an application which processes HTTP requests, and it prints out certain information about the request as it processes it to stdout. In this scenario, I have run disown -h and disown on the ...
CassOnMars's user avatar
3 votes
1 answer
2k views

Disowned command with redirected STDOUT/STDERR still sending output to shell [closed]

I defined a function in my .bashrc that allows me to open e.g. pdf files from bash by running copen myfile.pdf: function copen { if [[ $# -eq 1 ]] ; then xdg-open "$1" > /dev/null 2>...
cbaumhardt's user avatar
3 votes
1 answer
851 views

Child process continues to run if parent dies

I have a bash script which is executed via the GUI (lightdm). In some line during the script, I want it to: sudo service lightdm stop - stop the GUI Take over a TTY (like tty1 or tty7) using e.g.: ...
Dor's user avatar
  • 2,555
3 votes
1 answer
215 views

Clarification for Bash documentation on disown builtin option -h

According to the documentation: To prevent the shell from sending the SIGHUP signal to a particular job, it should be removed from the jobs table with the disown builtin or marked to not ...
Zhro's user avatar
  • 2,699
2 votes
0 answers
607 views

Any caveats to using bash disown from a shell script as an alternative to screen?

I have a process which starts and outputs to a log file. The script which starts it launches it in a GNU screen and then follows the log with tail. The process will immediately begin writing to the ...
Zhro's user avatar
  • 2,699
4 votes
3 answers
5k views

automatically disown application when running it from a terminal

How do you automatically disown an application after you have started it from a terminal? For example: if you start a terminal and run firefox the application will start, but when you then close the ...
PDiracDelta's user avatar
8 votes
1 answer
8k views

Stealing and reattaching a running process [duplicate]

It's sunday and I left an instance of R running in the office. The script finished running, and I would like to save my workspace without going to the office. I can ssh to the computer, but I have not ...
Three Diag's user avatar
1 vote
1 answer
1k views

How to recover a process GUI after broken pipe

I started a process with GUI from the command line in a remote computer using ssh -X. Knowing it would take a long time to run it, I left it in the background and disowned. As I feared, I had ...
franchzilla's user avatar
45 votes
6 answers
93k views

How can I detach a process from a bash script?

I am trying to detach a process from a bash script so that SIGINT will not be forwarded to the process when I exit the script. I have used the disown command in terminal directly, however in bash, ...
user2328113's user avatar
1 vote
0 answers
512 views

Ways to make a process survive its parent shell's exiting?

In order for a process to survive its parent shell's exiting, what necessary and sufficient conditions does the process need to meet? Specifically considering signals, what signals should be ...
Tim's user avatar
  • 103k
1 vote
2 answers
219 views

Does a disowned process receive signals other than SIGHUP?

Is it correct that a shell can send signals only to its jobs, but can't send signals to processes which are not its jobs? disown moves a job out of the job list of a shell. Does that mean a disowned ...
Tim's user avatar
  • 103k
3 votes
1 answer
692 views

Why the kernel kills my process with disown when I logout?

I would like to understand the behavior of a process running with disown when a SIGHUP (or similar) from a shell logout occurs. The process simply does the following: sleep 15 seconds print "hello"; ...
Javier Tacón's user avatar
4 votes
1 answer
884 views

Is there an overlap in the uses of PID and jobspec in Bash?

Is there an overlap in the uses of PID and jobspec in Bash? In my script I store the PID of a command in a variable using $!. Then I call disown with the PID to remove the job from the shell's active ...
mattst's user avatar
  • 505
0 votes
1 answer
137 views

Cannot disown mplayer?

mplayer -vo null -ao alsa test.mp3 & disown It returns sh: 1 : disown: not find Why it doesn't work?
Junior's user avatar
  • 343
10 votes
3 answers
5k views

In zsh, how can I more quickly disown the foreground process?

My method for disowning the foreground process takes too much effort. Suppose I have a process in zsh's foreground. I want to disown it, so I can close the shell without the process being sent a ...
Anko's user avatar
  • 4,556
7 votes
1 answer
2k views

Is it possible to add a process to the job list in bash (e.g. to reverse "disown")?

If I disown a job in bash and change my mind, can I undo it somehow ? If so, taking it further, is it possible to bring an arbitrary process under job control (an acceptable restriction would be that ...
starfry's user avatar
  • 7,520
19 votes
1 answer
22k views

Change the parent process of a process?

Is it possible to change the parent process of a process? If yes, how? For example, how does screen manage to attach a screen session and the processes running inside it to different shell ...
Tim's user avatar
  • 103k
1 vote
1 answer
156 views

Prognosis for disowned X11 program. Can I un-disown it?

I have a disowned X11 program, running under my user account. I started it during an SSH session that was disconnected due to a network problem. I'd like to continue working with it, if possible. Can ...
Tom Seddon's user avatar
4 votes
3 answers
6k views

How to completely detach a process

I want to spawn a process and run it at the top level so that when the shell exits, the process keeps running. I had mistakenly thought that nohup would do this, but when I exit from the shell (the ...
Goblinhack's user avatar
14 votes
1 answer
13k views

Detach a process from Sh (not Bash) or “disown” for Sh (not Bash)

Consider a shell script executed by Sh, not Bash (and I can't change it, and can't use a shebang, it's ignored). The & operator works, but disown $! does not and makes Sh complains “disown: not ...
Hibou57's user avatar
  • 905
2 votes
2 answers
1k views

Is it necessary to disown a process for it to continue running after disconnecting?

Would someone explain if & why disown is necessary if you wish to keep a job running even after you disconnect. I ask because every site I have visited says to use disown and bg but bg on its own ...
E-71's user avatar
  • 43