Generating a perl script to count the number of available VM sessions produces a error when trying to run the script in SAM to set up an alert to the Support Center. The script runs in demand but errors in SAM. The script below and output. I am expecting just a static number to alert on. What could be the issue?
Script Arguments: perl ${SCRIPT} arg1 arg2
Script Body:
#!/usr/bin/perl
$app_name = "Service to Count the number of available Nodes for EOD in each environment";
$count = 'grep available /osg/eod/nXXXXXXXXX01/selector/state.table | wc -l | awk '{printf(“%d”,$1)}' ';
print "Message: NOTE: $app_name app available nodes. \n";
print "Statistic: $count\n";
exit 0;
Output:
Testing on node 'XXX.XXX.XXX.XXX failed with 'Unknown' status ('Unknown' might be different if script exits with a different exit code).
perl /tmp/APM_1227828680.pl arg1 arg2
syntax error at /tmp/APM_1227828680.pl line 4, near "'grep available /osg/eod/nXXXXXXXXX01/selector/state.table | wc -l | awk '{"
Execution of /tmp/APM_1227828680.pl aborted due to compilation errors.
Output: =====================================================
perl /tmp/APM_1227828680.pl arg1 arg2
syntax error at /tmp/APM_1227828680.pl line 4, near "'grep available /osg/eod/nXXXXXXXXX01/selector/state.table | wc -l | awk '{"
Execution of /tmp/APM_1227828680.pl aborted due to compilation errors.