Have a problem in running unix code in jsp page, my jsp code is as below.
<%@page language="java" %>
<%@page import="java.util.*" %>
<html>
<head>
<%
String unixCommand = "/bin/bash -lc \"/home/chandu/test/./check.sh xxxxxx\"";
Runtime rt = Runtime.getRuntime();
rt.exec(unixCommand);
System.out.println("Print Test Line.");
%>
</head>
<body>
</body>
</html>
Unix code is below
!/bin/bash -l
cd /home/chandu/test/
for i in cat nodelist
do
java -cp /home/chandu/test jcmd "$i" ZMIO:MSISDN=$1: > "$i".log
done
vlradd=grep MSC-ADDRESS *.log | awk '{print $4}'
mss=grep $vlradd mss | awk '{print $1}'
java -cp /home/chandu/test jcmd "$mss" ZMVO:MSISDN=$1: | egrep "LOCATION AREA CODE OF IMSI|LAST USED CELL ID" | cut -d "/" -f2 > output
lac=head -1 output | tail -1
cellid=head -2 output | tail -1
echo $lac $cellid
You have new mail in /var/mail/root