Thursday, July 5, 2018

Auto start Tomcat and CloverETL on EC2 AWS Linux AMI

In one of the previous blog posts I installed evaluation CloverETL server on Amazon's EC2 instance. This installation is useful for evaluation, quick setup and I mentioned at the end of article that you might want to set CloverETL server to start up automatically if host gets restarted.

This article will show you one way how.

Prerequisites:

Last time we installed Tomcat and deployed server war to:

/clover/CloverETLServer.4.5.1.Tomcat-8.0.30/bin

(In retrospect keeping name of version in the directory name wasn't greatest idea, that's when you will try to upgrade, but again..evaluation installation.)

Steps:


First thing I will do is to create init script:
sudo vim /etc/init.d/clover

#!/bin/bash ### BEGIN INIT INFO # Provides:        tomcat8 # Required-Start:  $network # Required-Stop:   $network # Default-Start:   2 3 4 5 # Default-Stop:    0 1 6 # Short-Description: Start/Stop Tomcat server ### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
start() {  sh /clover/CloverETLServer.4.5.1.Tomcat-8.0.30/bin/startup.sh }
stop() {  sh /clover/CloverETLServer.4.5.1.Tomcat-8.0.30/bin/shutdown.sh }
case $1 in   start|stop) $1;;   restart) stop; start;;   *) echo "Run as $0 <start|stop|restart>"; exit 1;; esac


There might be different versions of init script, this one makes sure that you will run in only after network interface is set up on the instance.

Last step is to put this init script to be run after reboot. Common way to do is with update-rc.d command, but that one is not installed on Amazon Linux AMI for some reason.

Another way that worked for me was:
sudo chmod 755 /etc/init.d/clover
sudo chkconfig --level 345 clover on

After these steps Tomcat and CloverETL server should automatically after reboot of the host.

(I used heavily answers here https://askubuntu.com/questions/223944/how-to-automatically-restart-tomcat7-on-system-reboots )




2 comments:

  1. I guess you are a smart cookie because of your knowledge and insight. The articles brings some advice. I learn more from them. Please update more posts. I usually read them. Thank you very much. autoketing email with love web,autoketing email with love apps

    ReplyDelete
  2. I guess you are a smart cookie because of your knowledge and insight. The articles brings some advice. I learn more from them. Please update more posts. I usually read them. Thank you very much. autoketing email with love web,autoketing email with love apps

    ReplyDelete