Hi Lars,

Because I found setsid have a different behavior between interactive shell and 
non-interactive shell.

I show the command first:

see@linux-ub7v:~> setsid sleep 5 & echo "$! setsid"; sleep 1; ps -eo pid,args | 
grep sleep | grep -v grep
12498 setsid
12502 sleep 5

see@linux-ub7v:~> killall sleep

see@linux-ub7v:~> bash -c 'setsid sleep 5 & echo "$! setsid"; sleep 1; ps -eo 
pid,args | grep sleep | grep -v grep'
12507 setsid
12507 sleep 5

see@linux-ub7v:~> setsid --version
setsid from util-linux 2.21.2
The first commands were executed by an interactive shell, we can see there are 
the different pid between setsid and sleep, 

but the third commands, I put them into a non-interactive shell, and 
then, we can see there are the same pid of setsid and sleep.

I guess setsid in first command may be "fork -> exec sleep by child 
-> parent exit" and setsid in third command just do "exec sleep" 
directly.

If I am right, why does setsid have a different behavior between interactive 
shell and non-interactive shell ?

So I am not sure the setsid have a same behavior on each LINUXs,  can you point 
me ?
Thanks in advance!

Best regards,
John

>>> Lars Ellenberg <lars.ellenb...@linbit.com> 2013-1-21 下午 18:44 >>>
On Sun, Jan 20, 2013 at 09:23:05AM -0700, John Shi wrote:
>     Medium: tools: ocft: update to version 0.44
>     
>     Added "incremental" mode (ocft test -i) , cache results and
>     not repeatedly rerun those cases which succeeded.
>     
>     Improved *ocft make*, the ocft will only make the updated test-case file.
>     
>     The ocft test prints the actual case names instead of just case numbers.
> 
> 

> From efaeb8c675c8dfbbeb2e6c6068a281f2ce53bf22 Mon Sep 17 00:00:00 2001
> From: John Shi <j...@suse.com>
> Date: Sun, 20 Jan 2013 23:35:00 +0800
> Subject: [PATCH] Medium: tools: ocft: update to version 0.44
> 
> Added "incremental" mode (ocft test -i) , cache results and
> not repeatedly rerun those cases which succeeded.
> 
> Improved *ocft make*, the ocft will only make the updated test-case file.
> 
> The ocft test prints the actual case names instead of just case numbers.

There is nothing in the commit message about changed "kill" behaviour.

And I don't think I understand nor like that change.

You do:

> -  setsid $aroot/$agent $cmd >/tmp/.ocft_runlog 2>&1 &
> +  $aroot/$agent $cmd >/tmp/.ocft_runlog 2>&1 &
>    pid=$!
>  
>    i=0
> @@ -111,9 +111,9 @@ agent_run()
>    done
>  
>    if [ $i -ge $timeout ]; then
> -    kill -SIGTERM -$pid >/dev/null 2>&1
> +    kill -SIGTERM $pid >/dev/null 2>&1
>      sleep 3
> -    kill -SIGKILL -$pid >/dev/null 2>&1
> +    kill -SIGKILL $pid >/dev/null 2>&1


The setsid and "kill -SIG -$pid" was intentional,
to be sure to kill the process group.
Agents may spawn childs, killing
the agent should cleanup those childs as well.

Why did you change that?

Did it not work?
Break something?

Thanks,

-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/



_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to