I have an ubuntu server running a java/tomcat server that delivers an application. I also use apache2 as an SSL reverse proxy. I want to create a web page by which our helpdesk team can stop and start the java application as needed.
I have created a directory that is not proxied and a perl script (index.pl) that uses ps and grep to determine whether the java app is running and it displays a red or green light accordingly. So far, so good. I would now like a button or link to STOP TASK or START TASK.
I have created a pair of perl scripts to do this. They work from the command line but not when called via the web page. Would someone be able to point out where I've gone astray? Attached is the stop-app.pl script.
# Script to provide a page where users can stop and start the java app.
print "content-type: text/html \n\n"; # Tell perl to create some HTML
print "<title>myapp Admin Page</title>";
print "<center><h1>myapp Admin Page</h1><br />";
print "<img src='/myapp/hourglass.jpg' /><br />";
print "<h1>Java App is being shut down.</h1>\n";
print "<a href='/myapp/index.pl'><img src='/myapp/proceedbutton.gif' alt='Proceed' /></a>\n";
system("sudo service myapp stop");
# Here endeth the script.