Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-06-2005, 12:59 PM   #1
LQ Newbie
Registered: Jul 2005
Posts: 2

Rep: Reputation: 0
Can bash create a detached process?

I'd like to be able to submit a shell script to run as a detached job.
Is it possible to do this from bash?
Old 07-06-2005, 04:31 PM   #2
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
You mean
some_command &
? Not sure if that's what you mean.

Last edited by Mara; 07-06-2005 at 04:34 PM.
Old 07-09-2005, 07:32 PM   #3
Senior Member
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
You can fork twice:
( ( & ) & )
that will let run after the shell it was launced from is destroyed.

Old 07-06-2012, 07:58 PM   #4
LQ Newbie
Registered: Jul 2012
Posts: 6
Blog Entries: 1

Rep: Reputation: Disabled
bash? What about ksh and others?

I edited a script called go on a server where I was sshed in. The shell was ksh, but I have also tried this with bash and zsh.

go was very simple but gave me remote evidence of the process contrinuing.

cd slideshow
python -m SimpleHTTPServer

was the sum total of go.

I put the cwd to the directory where go was resident, then

scsbrsweb1:/home/michmoor>at -t 06061643 -f go

where that time was 2 minutes from the time I hit return.

Once I was done, I waited to make sure the process started, with

scsbrsweb1:/home/michmoor>ps axwww|grep python
21710 ? SN 0:00 python -m SimpleHTTPServer
21717 pts/0 S+ 0:00 grep python

then I signed off and used a browser to look at the server's port 8000 to make sure the slideshow file was available for download. It was.

The "at" command is far more useful than one might imagine. I started putting it in SPEC files to get by a hostile %postun that would remove files I had updated for an rpm. It didn't stop the %postun but repaired the damage a minute later.
Old 07-08-2012, 08:28 PM   #5
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,329

Rep: Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745
@magnanimousmargrave: please don't resurrect ancient threads; this one was originally done in 2005(!)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
what happens if i create a thread and then fork the process? Thinking Programming 7 10-31-2005 03:22 PM
How to create a bash script to automatically disown a process. jon_k Linux - Software 5 06-19-2005 06:53 AM
Create process phoenix_fei Programming 2 01-20-2005 09:30 AM
Bash Scripting - child process affecting parent process mthaddon Linux - General 1 05-02-2004 02:19 PM
No detached Bitchx process bugsbunny Slackware 0 04-18-2004 06:30 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:38 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration