Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have written a bash script that periodically checks a directory for newly added .ear files and copies them to the respective JBoss server's deploy directory.Before copying, it checks if JBoss is running, and stops it if it is.After copying the file,it removes the older .ear files if any,and starts JBoss.
I am trying to have this script executed via a web page. i.e provide a link to the users, clicking on which, the entire process gets executed.So far I am not able to get the desired result, though manually executing it works.
I'm getting the following error in http logs:

warn] [client] Timeout waiting for output from CGI script /var/www/cgi-bin/, referer: http://localhost/

Would appreciate if someone could shed some light on how to go about it.

share|improve this question
isn't this what jboss' autodeploy does? :) – rytis Feb 8 '10 at 15:06
  1. The CGI script will run with the userid of the webserver, which might not be the userid of the person who was testing it. Have you considered that?

  2. The CGI script needs to print a header and some output like "Success, thanks for using".

 echo "Content-type: text/plain"
 echo "Success, thanks for using"

If its too clunky trying to do CGI from the shell, wrap it in a little bit of perl or python which have libraries to deal with CGI.

An alternative approach would be to leave a token in a file or database column that tells it to run, and then have it either activate from cron or have it constantly run and look for the token.

Also, depending on how the web server is set up, your CGI only gets so long to run before it times out...

share|improve this answer
+1 Started to type the same thing as token/cron but then noticed you already said it :-) – Kyle Brandt Feb 8 '10 at 14:57
A proper content-type would be text/plain, not just text – grawity Feb 8 '10 at 20:51
Thanks. I edited the answer to reflect your contribution. – Paul Feb 8 '10 at 23:13

Thanks a ton, ~drpaulbrewer and others.It was certainly a permission issue.Have managed to get it working by giving the necessary permissions to apache in sudoers file.Was also getting a '[error] [client] standard in must be a tty, referer: http://localhost/' error in the logs, which I got rid of by excluding apache from the 'Defaults requiretty' section in the sudoers file.

Though I had initially thought of running the script as a cronjob, it was not implemented, since we are running this on a test environment, and have multiple instances of JBoss running simultaneously.We thought it would be better to let the users trigger the script manually, hence this approach.

Thanks again. Nagaraj

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.