java environment + cron issue
On a unix RH8 box starting and stopping TC 5.0.18 under the root account using the following script: #!/bin/sh # This script stops tomcat for (about) 1 minute, and then restarts it # it is run at the same time as the script to backup the # database (which is shutdown, and a file level copy made) echo Stopping Tomcat at `date` /usr/local/jakarta-tomcat-5.0.18/bin/shutdown.sh echo Tomcat shutdown at `date` sleep 15 echo Starting Tomcat at `date` /usr/local/jakarta-tomcat-5.0.18/bin/startup.sh stops and starts TC as expected, and after TC is restarted all my JSP's correctly render UTF-8 strings. However if the script is invoked from cron, the JSPs render all non-standard ASCII characters (like accented ones) as a ? (question mark), until TC is restarted again by executing the above script under the root account. Does anyone know what the cause of the problem is, and how to fix it? (We will be upgrading to TC 5.0.28 shortly, but I don't think the TC version is the issue). There must be some kind of enviroment issue going on that I don't understand. Thanks John Sidney-Woollett ps here is the cron entry (created using crontab -e from the root account). # crontab -l # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.11679 installed on Fri Aug 20 07:12:03 2004) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) 45 3 * * * /bin/nice /usr/bin/rsync-backup-client / [EMAIL PROTECTED]:/ # Pause tomcat for database backup, make sure this job is run # at the same time as the db backup job on ddgfe1a 5 5 * * * /usr/local/bin/pauseTC.sh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: java environment + cron issue
I don't know the cause of your problem, but personaly I use nohup to start commands from cron : nohup /usr/local/jakarta-tomcat-5.0.18/bin/shutdown.sh nohup manage in good way standard input and output (you can pass options) and keep your task running after father task die. Hope it help. Andre John Sidney-Woollett wrote: On a unix RH8 box starting and stopping TC 5.0.18 under the root account using the following script: #!/bin/sh # This script stops tomcat for (about) 1 minute, and then restarts it # it is run at the same time as the script to backup the # database (which is shutdown, and a file level copy made) echo Stopping Tomcat at `date` /usr/local/jakarta-tomcat-5.0.18/bin/shutdown.sh echo Tomcat shutdown at `date` sleep 15 echo Starting Tomcat at `date` /usr/local/jakarta-tomcat-5.0.18/bin/startup.sh stops and starts TC as expected, and after TC is restarted all my JSP's correctly render UTF-8 strings. However if the script is invoked from cron, the JSPs render all non-standard ASCII characters (like accented ones) as a ? (question mark), until TC is restarted again by executing the above script under the root account. Does anyone know what the cause of the problem is, and how to fix it? (We will be upgrading to TC 5.0.28 shortly, but I don't think the TC version is the issue). There must be some kind of enviroment issue going on that I don't understand. Thanks John Sidney-Woollett ps here is the cron entry (created using crontab -e from the root account). # crontab -l # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.11679 installed on Fri Aug 20 07:12:03 2004) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) 45 3 * * * /bin/nice /usr/bin/rsync-backup-client / [EMAIL PROTECTED]:/ # Pause tomcat for database backup, make sure this job is run # at the same time as the db backup job on ddgfe1a 5 5 * * * /usr/local/bin/pauseTC.sh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: java environment + cron issue
Hi John, In article [EMAIL PROTECTED], Wed, 01 Sep 2004 09:01:24 +0100, John Sidney-Woollett [EMAIL PROTECTED] wrote: johnsw On a unix RH8 box starting and stopping TC 5.0.18 under the root account johnsw using the following script: [snip] johnsw However if the script is invoked from cron, the JSPs render all johnsw non-standard ASCII characters (like accented ones) as a ? (question johnsw mark), until TC is restarted again by executing the above script under johnsw the root account. You might try compare results of /usr/bin/env executed from cron and command-line. You may need to set some environment variables, LANG for example, to make JVM works as you expected. Hope this helps. Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: java environment + cron issue
You might try compare results of /usr/bin/env executed from cron and command-line. You may need to set some environment variables, LANG for example, to make JVM works as you expected. You're right - when the script is run by cron the LANG environment variable is undefined. I will modify the script to set the variable and see what happens tomorrow. Thanks for the answer! John Sidney-Woollett - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]