LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 07-06-2005, 11:59 AM   #1
GN9500
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, 03:31 PM   #2
Mara
Moderator
 
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 03:34 PM.
 
Old 07-09-2005, 06:32 PM   #3
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

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

Dave
 
Old 07-06-2012, 06:58 PM   #4
magnanimousmargrave
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, 07:28 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,342

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


Reply


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 02:22 PM
How to create a bash script to automatically disown a process. jon_k Linux - Software 5 06-19-2005 05:53 AM
Create process phoenix_fei Programming 2 01-20-2005 08:30 AM
Bash Scripting - child process affecting parent process mthaddon Linux - General 1 05-02-2004 01:19 PM
No detached Bitchx process bugsbunny Slackware 0 04-18-2004 05:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:27 PM.

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