cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 9

Bash Script producing string need a number or statistic

I am running this script. It is giving me an error.

 

Scripting Error: Script does not contain the expected parameters or is improperly formatted. 'Statistic' missing.
Output: =====================================================
perl /tmp/APM_1223501119.pl arg1 arg 2
sh: -c: line 0: unexpected EOF while looking for matching `"'
sh: -c: line 1: syntax error: unexpected end of file
Message: NOTE: Service to count the number of instances of WS Used on a Node app instance count.
Statistic:

 

The script looks like this:

#!/usr/bin/perl

$app_name = "Service to count the number of instances of WS Used on a Node";
$count = `/usr/bin/ps -ef | grep "/osg/eod/selector/session$" | grep -vw grep | wc -l`;
print "Message: NOTE: $app_name app instance count. \n";
print "Statistic: $count\n";

exit 0;

 

It is producing a string number and it needs a integer number. How can I get a number

0 Kudos
1 Reply
Level 9

Hi,

I am not an expert with Perl, but i think this highlights the issue:
sh: -c: line 0: unexpected EOF while looking for matching `"'
sh: -c: line 1: syntax error: unexpected end of file

 

in your script the single quotes have copied in incorrectly so ti isn't executing correctly. I would edit that script and change those single quote characters manually and then try it again.

 

the outputs of the script look right to me from what i can see. i just think the issue with with the script itself failing, rather than the output.

0 Kudos