[Chicago-talk] system command to kill Xwindows session?

Alexander Danel danel at speakeasy.net
Sun Mar 7 08:29:57 PST 2010


You didn't telll me if you are on UNIX.

The "startx" script has to give you the PID, which it currently isn't doing,
and then you have to gather the PID.

In "startx", assuming Unix

	$!/bin/ksh
	Foobar &
	echo $!

I assume you are using the '&' to background "Foobar".  The '$!' gives you
pid of background job, but must be immediately following "Foobar &" command.

In Perl, you gather the echoed PID by using "qx" instead of system()

my $thePid = qx/startx/;

Now you can kill $thePid.

Got to go.  Goodluck, bye.

Alexander

-----Original Message-----
From: chicago-talk-bounces+danel=speakeasy.net at pm.org
[mailto:chicago-talk-bounces+danel=speakeasy.net at pm.org] On Behalf Of
Richard Reina
Sent: Sunday, March 07, 2010 10:06 AM
To: Chicago.pm chatter
Subject: Re: [Chicago-talk]system command to kill Xwindows session?

I have script that starts an xwindows session with system("startx") I want
it to end as soon as a specific tast is done? 


---- Chicago.pm chatter <chicago-talk at pm.org> wrote:
>
> Your question is incoherent; obviously if you are looking for a system
> command, then its not a Perl function.
> 
> How did you start the process that opened the window, and are you willing
to
> kill the entire process?  
> 
> On Unix, if you know the process-id, then try:
> 
> 	system("kill TERM $thePid");
> 
> Alexander
> 
> -----Original Message-----
> From: chicago-talk-bounces+danel=speakeasy.net at pm.org
> [mailto:chicago-talk-bounces+danel=speakeasy.net at pm.org] On Behalf Of
> Richard Reina
> Sent: Sunday, March 07, 2010 9:18 AM
> To: chicago-talk at pm.org
> Subject: [Chicago-talk] system command to kill Xwindows session?
> 
> Does anyone know if there is a perl fucntion or a command that can be put
> into system("") that will kill Xwindow and return a script/user to the
> console?
> 
> Thanks,
> 
> Richard
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
> 
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
> 
_______________________________________________
Chicago-talk mailing list
Chicago-talk at pm.org
http://mail.pm.org/mailman/listinfo/chicago-talk



More information about the Chicago-talk mailing list