开发者

Can you spawn a process in a shell script?

开发者 https://www.devze.com 2023-03-29 18:20 出处:网络
I\'m trying to get my #!/bin/sh shell script to start another application without pausing execution. That is I\'m looking for a way to launch it in the background and have my shell script keep executi

I'm trying to get my #!/bin/sh shell script to start another application without pausing execution. That is I'm looking for a way to launch it in the background and have my shell script keep executing. I want it to work somethi开发者_StackOverflow中文版ng like this:

# start daemon
start(){
success=`launch '/path/to/daemon'`
if [ $success != false ];then
echo 'daemon is now running'
fi

I'm also new to shell scripting so will the above (if launch existed) get the return of launch or the stdout set as $success?

I want to only use SH not BASH.


Use '&' sign after program name to launch it in background. Putting a program in the background


use NOHUP. http://en.wikipedia.org/wiki/Nohup and send output to log using >> mylogfilename

0

精彩评论

暂无评论...
验证码 换一张
取 消