CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Error issuing system kill command


New User

Nov 16, 2012, 9:03 AM

Post #1 of 2 (2979 views)
Error issuing system kill command Can't Post

I am attempting to issue the following kill command which works in the shell but not in my program...


print "Performing agent status check...\n";

eval {

local $SIG{ALRM} = sub {die "alarm\n"};

alarm 30;


alarm 0;


if($@) {

die unless $@ eq "alarm\n";

print "Agent status check timed out, killing agent processes...\n";

system("/usr/bin/ps -ef | /usr/bin/grep '[a]gent12g' | /usr/bin/awk '{print $2}' | /usr/bin/xargs /usr/bin/kill");

print "Process IDs have been killed, restarting agent...\n";


Performing agent status check...

Oracle Enterprise Manager 12c Cloud Control

Copyright (c) 1996, 2012 Oracle Corporation. All rights reserved.


Use of uninitialized value in concatenation (.) or string at

./ line 53 (#1)

(W uninitialized) An undefined value was used as if it were already

defined. It was interpreted as a "" or a 0, but maybe it was a mistake.

To suppress this warning assign a defined value to your variables.

To help you figure out what was undefined, perl tells you what operation

you used the undefined value in. Note, however, that perl optimizes your

program and the operation displayed in the warning may not necessarily

appear literally in your program. For example, "that $foo" is

usually optimized into "that " . $foo, and the warning will refer to

the concatenation (.) operator, even though there is no . in your


Agent status check timed out, killing agent processes...

/usr/bin/kill[8]: oracle: Arguments must be %job or process ids

Thanks in advance for any help.

New User

Nov 16, 2012, 12:23 PM

Post #2 of 2 (2971 views)
Re: [justij] Error issuing system kill command [In reply to] Can't Post

Solved issue. An escape character was needed in the awk argument when passing the command to the shell.

system("/usr/bin/ps -ef | /usr/bin/grep '[a]gent12g' | /usr/bin/awk '{print \$2}' | /usr/bin/xargs /usr/bin/kill ");



Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives