spawn an entirely separate proccess in linux via bash


spawn an entirely separate proccess in linux via bash



I need to have a script execute (bash or perl or php, any will do) another command and then exit, while the other command still runs and exits on its own. I could schedule via at command, but was curious if there was a easier way.


API to translate group name to group id (gid)

1:

What scripts should not be ported from bash to python?
#!/bin/sh  your_cmd &  echo "started your_cmd, now exiting!" 
Similar constructs exists for perl and php, although in sh/bash its very easy to run ananother command in the background and proceed.. Vim + OmniCppComplete: Completing on Class Members which are STL containers edit. How do I bring a processes window to the foreground on X Windows? (C++) A very good source for generic process manipulation are all the start scripts under /etc/init.d. How communicate with pty via minicom or screen?They did all sorts of neat tricks such as keep track of pids, executing basic start/stop/restart commands etc.. Script to parse emails for attachments
When assert() fails, what is the program exit code?call external program in python, watch output for specific text then take action

2:

To run a command in the background, you must append an '&' to the command.. If you need the program to last past your login session, you must use nohup.. See this similar stackoverflow discussion: how to run a command in the background ....

3:

&?.
     #!/usr/bin/bash     # command1.sh: execute command2.sh and exit     command2.sh & 

4:

I'm not entirely sure if this is what you are looking for, although you must background a process executed in a shell by appending the ampersand (&) symbol as the last character of the command.. So if you have script, a.sh. and a.sh needs to spawn a seperate process, like say execute the script b.sh, you'd:.
b.sh & 

5:

The usual way to run a command and have it keep running when you log out is to use nohup(1). nohup prevents the given command from receiving the HUP signal when the shell exits. You also need to run in the background with the ampersand (&) command suffix..
$ nohup any _command arg1 arg2 & 

6:

So long as you mentioned Perl:.
fork || exec "ls"; 
...where "ls" is anything at all. Repeat for as many commands as you need to fire off..


96 out of 100 based on 51 user ratings 206 reviews

*