Selasa, 26 Juni 2018

How to start TomcatStack apache tomcat mysql from command line

  Tidak ada komentar
Some time as sys admin we face a some request from developer to deploy or maintenance the tomcat webserver, we have to restart and trouble shoot the webserver here are some experience that i did when i was got the case.
Step 1: Check status service
Enter the tomcat stack directory as following figure
[root@simlalabim tomcatstack-7.0.86-0]# ls
apache2        bnsupport       config        licenses               properties.ini  uninstall
apache-ant     bnsupport-tool  ctlscript.sh  manager-linux-x64.run  README.txt      uninstall.dat
apache-tomcat  changelog.txt   img           mysql                  scripts         use_tomcatstack
apps           common          java          php                    sqlite
[root@simlalabim tomcatstack-7.0.86-0_dua]#
Make sure the ctrl script path was right
[root@simlalabim tomcatstack-7.0.86-0]$ cat ctlscript.sh
#!/bin/sh

# Allow only root execution
if [ `id|sed -e s/uid=//g -e s/\(.*//g` -ne 0 ]; then
    echo "This script requires root privileges"
    exit 1
fi


# Disabling SELinux if enabled
if [ -f "/usr/sbin/getenforce" ] && [ `id -u` = 0 ] ; then
    selinux_status=`/usr/sbin/getenforce`
    /usr/sbin/setenforce 0 2> /dev/null
fi

INSTALLDIR=/opt/tomcatstack-7.0.86-0

if [ -r "$INSTALLDIR/scripts/setenv.sh" ]; then
. "$INSTALLDIR/scripts/setenv.sh"
fi
Execute following command
sudo ./ctlscript.sh status
It will response
apache not running
tomcat not running
mysql not running

Step 2: Start the service
Execute the following command if you down know the command to do it
[root@simlalabim tomcatstack-7.0.86-0]# ./ctlscript.sh help
usage: ./ctlscript.sh help
       ./ctlscript.sh (start|stop|restart|status)
       ./ctlscript.sh (start|stop|restart|status) mysql
       ./ctlscript.sh (start|stop|restart|status) apache
       ./ctlscript.sh (start|stop|restart|status) tomcat

help       - this screen
start      - start the service(s)
stop       - stop  the service(s)
restart    - restart or start the service(s)
status     - show the status of the service(s)
You can start all services by running following command
[root@simlalabim tomcatstack-7.0.86-0]# ./ctlscript.sh start
Or you can start a service (example tomcat ) by running following command
[root@simlalabim tomcatstack-7.0.86-0]# ./ctlscript.sh start tomcat

Tidak ada komentar :

Posting Komentar