You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by John Sidney-Woollett <jo...@wardbrook.com> on 2004/09/01 10:01:24 UTC

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 / root@hrde1a:/
# 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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: java environment + cron issue

Posted by Kazuhito SUGURI <su...@lab.ntt.co.jp>.
Hi John,

In article <41...@wardbrook.com>,
Wed, 01 Sep 2004 09:01:24 +0100,
John Sidney-Woollett <jo...@wardbrook.com> 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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: java environment + cron issue

Posted by Andre Legendre <ha...@yahoo.com>.
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 / root@hrde1a:/
> # 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: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org