Automated Tomcat start via Cron
search cancel

Automated Tomcat start via Cron

book

Article ID: 247692

calendar_today

Updated On:

Products

Output Management Web Viewer

Issue/Introduction

I am trying to automate the start of the web viewer product which we have running on a SUSE Linux box.

I have the following in crontab:

@reboot sudo sleep 300 && /usr/local/CA_OM_Web_Viewer/apache-tomcat-9.0.54/bin/startup.sh

The tomcat server starts, but there is an error when trying to connect to Web Viewer. Stopping and restarting Tomcat fixes the error.

Are there any instructions for starting the Web Viewer with Cron, or do you have any insight as to why it starts in error?

I've also tried starting the server without the 5 min delay but I get the same error.

Environment

Release : 12.1

Component : Output Management Web Viewer

Cause

Cron does not load environmental variables from files like /etc/profile, etc. 

Resolution

After reviewing the Tomcat log located in directory /usr/local/CA_OM_Web_Viewer/apache-tomcat-9.0.54/log, it was noticed that it showed CAOMWV12_HOME:null when Cron was used to start Tomcat.

To correct that, the environmental variable for CAOMWV12_HOME= would need to be added to Cron, since Cron does not load environmental variables when it executes jobs from files such as /etc/profile, etc. For this you would need to reach out to the Cron team to learn how to add that variable.