Starting Tomcat Service when starting CentOS/RHEL/Fedora The 2019 Stack Overflow Developer Survey Results Are InWhat's the difference between /sbin/nologin and /bin/falseCentOS VPS not starting after installing zPanelRunning tomcat under tomcat service account in CentOSCreating Group and User for Tomcat RHEL/CentOSCentOS 6 stuck at starting service (sendmail) & cannot loginOpenfire Service Starting then crashing on CentOSStarting Tomcat 8 on Raspbian - Job for tomcat8.service failedCan not open tomcat default page CentOSCan't start tomcat in digital ocean's CentOS server?Solaris 5.10 shell replacement for Centos 7 migrationTomcat startup.sh file works but starting tomcat.service does not

Getting crown tickets for Statue of Liberty

Worn-tile Scrabble

Can you cast a spell on someone in the Ethereal Plane, if you are on the Material Plane and have the True Seeing spell active?

"as much details as you can remember"

Does adding complexity mean a more secure cipher?

Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?

Will it cause any balance problems to have PCs level up and gain the benefits of a long rest mid-fight?

Why doesn't UInt have a toDouble()?

Inverse Relationship Between Precision and Recall

Relationship between Gromov-Witten and Taubes' Gromov invariant

Straighten subgroup lattice

The phrase "to the numbers born"?

Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?

Star Trek - X-shaped Item on Regula/Orbital Office Starbases

Does HR tell a hiring manager about salary negotiations?

Why isn't the circumferential light around the M87 black hole's event horizon symmetric?

Can I have a signal generator on while it's not connected?

What is the motivation for a law requiring 2 parties to consent for recording a conversation

How to notate time signature switching consistently every measure

How do I free up internal storage if I don't have any apps downloaded?

If a sorcerer casts the Banishment spell on a PC while in Avernus, does the PC return to their home plane?

What does Linus Torvalds mean when he says that Git "never ever" tracks a file?

How much of the clove should I use when using big garlic heads?

Why does the nucleus not repel itself?



Starting Tomcat Service when starting CentOS/RHEL/Fedora



The 2019 Stack Overflow Developer Survey Results Are InWhat's the difference between /sbin/nologin and /bin/falseCentOS VPS not starting after installing zPanelRunning tomcat under tomcat service account in CentOSCreating Group and User for Tomcat RHEL/CentOSCentOS 6 stuck at starting service (sendmail) & cannot loginOpenfire Service Starting then crashing on CentOSStarting Tomcat 8 on Raspbian - Job for tomcat8.service failedCan not open tomcat default page CentOSCan't start tomcat in digital ocean's CentOS server?Solaris 5.10 shell replacement for Centos 7 migrationTomcat startup.sh file works but starting tomcat.service does not



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I want to install tomcat 8 and run it at startup time



I am following these tutorials:



  1. Install Tomcat 7 on CentOS, RHEL, or Fedora

  2. How to install Tomcat 8 on a CentOS 6 VPS

I created the tomcat user:



# useradd -U -r -M -d /usr/local/ServerWeb/tomcat -s /sbin/nologin tomcat


The file was in /etc/init.d/tomcat



In the option 1:



#!/bin/bash 
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
JAVA_HOME=/opt/jdk
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
TOMCAT_HOME=/usr/local/tomcat
TOMCAT_USER=tomcat

case $1 in
start)
/bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
;;
stop)
/bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
;;
restart)
/bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
/bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
;;
esac
exit 0


In the Option 2:



#!/bin/bash
#
# tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start:
# Default-Stop:
# Description: Tomcat
# Short-Description: start and stop tomcat
### END INIT INFO

## Source function library.
#. /etc/rc.d/init.d/functions
export JAVA_HOME=/opt/jdk
export JAVA_OPTS="-Dfile.encoding=UTF-8
-Dnet.sf.ehcache.skipUpdateCheck=true
-XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled
-XX:+UseParNewGC
-XX:MaxPermSize=128m
-Xms512m -Xmx512m"
export PATH=$JAVA_HOME/bin:$PATH
TOMCAT_HOME=/usr/local/tomcat
TOMCAT_USER=tomcat
SHUTDOWN_WAIT=20

tomcat_pid() grep -v grep

start()
pid=$(tomcat_pid)
if [ -n "$pid" ]
then
echo "Tomcat is already running (pid: $pid)"
else
# Start tomcat
echo "Starting tomcat"
ulimit -n 100000
umask 007
/bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
fi


return 0


stop()
pid=$(tomcat_pid)
if [ -n "$pid" ]
then
echo "Stoping Tomcat"
/bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh

let kwait=$SHUTDOWN_WAIT
count=0;
until [ `ps -p $pid

case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
pid=$(tomcat_pid)
if [ -n "$pid" ]
then
echo "Tomcat is running with pid: $pid"
else
echo "Tomcat is not running"
fi
;;
esac
exit 0


I don't understand why this is needed in the start of option 2:



ulimit -n 100000
umask 007


I changed the ownership with chown -Rvh tomcat: /usr/local/tomcat/



Later



# chmod +x /etc/init.d/tomcat
# chkconfig --add tomcat`


But after restarting the CentOS 6.6, the service is not running.



Testing:



$ echo $JAVA_HOME
$

$ echo $PATH
/usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/IntUser/bin
$


In other words $JAVA_HOME and $PATH aren't assigned!!!



Trying to start manually (I did not assign password to tomcat user, which password should I use?):



$ service tomcat start
Password:
/bin/su: incorrect password
$


Running as root, I was checking:



# service tomcat start
This account is currently not available.
#


Checking the account:



# finger tomcat
Login: tomcat Name: Tomcat User
Directory: /usr/local/tomcat Shell: /sbin/nologin
Never logged in.
No mail.
No Plan.
#


# more /etc/passwd | grep tomcat
tomcat:x:493:490:Tomcat User:/usr/local/tomcat:/sbin/nologin
#


Checking the ownership:



# ls -al /usr/local/tomcat/
total 120
drwxr-xr-x. 9 tomcat tomcat 4096 Jun 27 09:29 .
drwxr-xr-x. 20 root root 4096 Jun 27 09:29 ..
drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 09:29 bin
drwxr-xr-x. 3 tomcat tomcat 4096 Jun 27 11:04 conf
drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 09:29 lib
-rw-r--r--. 1 tomcat tomcat 56977 May 19 15:03 LICENSE
drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 11:04 logs
-rw-r--r--. 1 tomcat tomcat 1397 May 19 15:03 NOTICE
-rw-r--r--. 1 tomcat tomcat 6741 May 19 15:03 RELEASE-NOTES
-rw-r--r--. 1 tomcat tomcat 16204 May 19 15:03 RUNNING.txt
drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 09:29 temp
drwxr-xr-x. 7 tomcat tomcat 4096 May 19 15:00 webapps
drwxr-xr-x. 3 tomcat tomcat 4096 Jun 27 11:04 work
#


Please help me.



Question 1:
The script was created in: /etc/init.d/tomcat. Why were $JAVA_HOME and $PATH not assigned?



Question 2
Is there a method to install a service without root privileges, that starts at boot time without intervention (e.g., sudo, su, etc)?










share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.





















    3















    I want to install tomcat 8 and run it at startup time



    I am following these tutorials:



    1. Install Tomcat 7 on CentOS, RHEL, or Fedora

    2. How to install Tomcat 8 on a CentOS 6 VPS

    I created the tomcat user:



    # useradd -U -r -M -d /usr/local/ServerWeb/tomcat -s /sbin/nologin tomcat


    The file was in /etc/init.d/tomcat



    In the option 1:



    #!/bin/bash 
    # description: Tomcat Start Stop Restart
    # processname: tomcat
    # chkconfig: 234 20 80
    JAVA_HOME=/opt/jdk
    export JAVA_HOME
    PATH=$JAVA_HOME/bin:$PATH
    export PATH
    TOMCAT_HOME=/usr/local/tomcat
    TOMCAT_USER=tomcat

    case $1 in
    start)
    /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
    ;;
    stop)
    /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
    ;;
    restart)
    /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
    /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
    ;;
    esac
    exit 0


    In the Option 2:



    #!/bin/bash
    #
    # tomcat
    #
    # chkconfig: - 80 20
    #
    ### BEGIN INIT INFO
    # Provides: tomcat
    # Required-Start: $network $syslog
    # Required-Stop: $network $syslog
    # Default-Start:
    # Default-Stop:
    # Description: Tomcat
    # Short-Description: start and stop tomcat
    ### END INIT INFO

    ## Source function library.
    #. /etc/rc.d/init.d/functions
    export JAVA_HOME=/opt/jdk
    export JAVA_OPTS="-Dfile.encoding=UTF-8
    -Dnet.sf.ehcache.skipUpdateCheck=true
    -XX:+UseConcMarkSweepGC
    -XX:+CMSClassUnloadingEnabled
    -XX:+UseParNewGC
    -XX:MaxPermSize=128m
    -Xms512m -Xmx512m"
    export PATH=$JAVA_HOME/bin:$PATH
    TOMCAT_HOME=/usr/local/tomcat
    TOMCAT_USER=tomcat
    SHUTDOWN_WAIT=20

    tomcat_pid() grep -v grep

    start()
    pid=$(tomcat_pid)
    if [ -n "$pid" ]
    then
    echo "Tomcat is already running (pid: $pid)"
    else
    # Start tomcat
    echo "Starting tomcat"
    ulimit -n 100000
    umask 007
    /bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
    fi


    return 0


    stop()
    pid=$(tomcat_pid)
    if [ -n "$pid" ]
    then
    echo "Stoping Tomcat"
    /bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh

    let kwait=$SHUTDOWN_WAIT
    count=0;
    until [ `ps -p $pid

    case $1 in
    start)
    start
    ;;
    stop)
    stop
    ;;
    restart)
    stop
    start
    ;;
    status)
    pid=$(tomcat_pid)
    if [ -n "$pid" ]
    then
    echo "Tomcat is running with pid: $pid"
    else
    echo "Tomcat is not running"
    fi
    ;;
    esac
    exit 0


    I don't understand why this is needed in the start of option 2:



    ulimit -n 100000
    umask 007


    I changed the ownership with chown -Rvh tomcat: /usr/local/tomcat/



    Later



    # chmod +x /etc/init.d/tomcat
    # chkconfig --add tomcat`


    But after restarting the CentOS 6.6, the service is not running.



    Testing:



    $ echo $JAVA_HOME
    $

    $ echo $PATH
    /usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/IntUser/bin
    $


    In other words $JAVA_HOME and $PATH aren't assigned!!!



    Trying to start manually (I did not assign password to tomcat user, which password should I use?):



    $ service tomcat start
    Password:
    /bin/su: incorrect password
    $


    Running as root, I was checking:



    # service tomcat start
    This account is currently not available.
    #


    Checking the account:



    # finger tomcat
    Login: tomcat Name: Tomcat User
    Directory: /usr/local/tomcat Shell: /sbin/nologin
    Never logged in.
    No mail.
    No Plan.
    #


    # more /etc/passwd | grep tomcat
    tomcat:x:493:490:Tomcat User:/usr/local/tomcat:/sbin/nologin
    #


    Checking the ownership:



    # ls -al /usr/local/tomcat/
    total 120
    drwxr-xr-x. 9 tomcat tomcat 4096 Jun 27 09:29 .
    drwxr-xr-x. 20 root root 4096 Jun 27 09:29 ..
    drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 09:29 bin
    drwxr-xr-x. 3 tomcat tomcat 4096 Jun 27 11:04 conf
    drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 09:29 lib
    -rw-r--r--. 1 tomcat tomcat 56977 May 19 15:03 LICENSE
    drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 11:04 logs
    -rw-r--r--. 1 tomcat tomcat 1397 May 19 15:03 NOTICE
    -rw-r--r--. 1 tomcat tomcat 6741 May 19 15:03 RELEASE-NOTES
    -rw-r--r--. 1 tomcat tomcat 16204 May 19 15:03 RUNNING.txt
    drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 09:29 temp
    drwxr-xr-x. 7 tomcat tomcat 4096 May 19 15:00 webapps
    drwxr-xr-x. 3 tomcat tomcat 4096 Jun 27 11:04 work
    #


    Please help me.



    Question 1:
    The script was created in: /etc/init.d/tomcat. Why were $JAVA_HOME and $PATH not assigned?



    Question 2
    Is there a method to install a service without root privileges, that starts at boot time without intervention (e.g., sudo, su, etc)?










    share|improve this question
















    bumped to the homepage by Community yesterday


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















      3












      3








      3


      2






      I want to install tomcat 8 and run it at startup time



      I am following these tutorials:



      1. Install Tomcat 7 on CentOS, RHEL, or Fedora

      2. How to install Tomcat 8 on a CentOS 6 VPS

      I created the tomcat user:



      # useradd -U -r -M -d /usr/local/ServerWeb/tomcat -s /sbin/nologin tomcat


      The file was in /etc/init.d/tomcat



      In the option 1:



      #!/bin/bash 
      # description: Tomcat Start Stop Restart
      # processname: tomcat
      # chkconfig: 234 20 80
      JAVA_HOME=/opt/jdk
      export JAVA_HOME
      PATH=$JAVA_HOME/bin:$PATH
      export PATH
      TOMCAT_HOME=/usr/local/tomcat
      TOMCAT_USER=tomcat

      case $1 in
      start)
      /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
      ;;
      stop)
      /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
      ;;
      restart)
      /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
      /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
      ;;
      esac
      exit 0


      In the Option 2:



      #!/bin/bash
      #
      # tomcat
      #
      # chkconfig: - 80 20
      #
      ### BEGIN INIT INFO
      # Provides: tomcat
      # Required-Start: $network $syslog
      # Required-Stop: $network $syslog
      # Default-Start:
      # Default-Stop:
      # Description: Tomcat
      # Short-Description: start and stop tomcat
      ### END INIT INFO

      ## Source function library.
      #. /etc/rc.d/init.d/functions
      export JAVA_HOME=/opt/jdk
      export JAVA_OPTS="-Dfile.encoding=UTF-8
      -Dnet.sf.ehcache.skipUpdateCheck=true
      -XX:+UseConcMarkSweepGC
      -XX:+CMSClassUnloadingEnabled
      -XX:+UseParNewGC
      -XX:MaxPermSize=128m
      -Xms512m -Xmx512m"
      export PATH=$JAVA_HOME/bin:$PATH
      TOMCAT_HOME=/usr/local/tomcat
      TOMCAT_USER=tomcat
      SHUTDOWN_WAIT=20

      tomcat_pid() grep -v grep

      start()
      pid=$(tomcat_pid)
      if [ -n "$pid" ]
      then
      echo "Tomcat is already running (pid: $pid)"
      else
      # Start tomcat
      echo "Starting tomcat"
      ulimit -n 100000
      umask 007
      /bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
      fi


      return 0


      stop()
      pid=$(tomcat_pid)
      if [ -n "$pid" ]
      then
      echo "Stoping Tomcat"
      /bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh

      let kwait=$SHUTDOWN_WAIT
      count=0;
      until [ `ps -p $pid

      case $1 in
      start)
      start
      ;;
      stop)
      stop
      ;;
      restart)
      stop
      start
      ;;
      status)
      pid=$(tomcat_pid)
      if [ -n "$pid" ]
      then
      echo "Tomcat is running with pid: $pid"
      else
      echo "Tomcat is not running"
      fi
      ;;
      esac
      exit 0


      I don't understand why this is needed in the start of option 2:



      ulimit -n 100000
      umask 007


      I changed the ownership with chown -Rvh tomcat: /usr/local/tomcat/



      Later



      # chmod +x /etc/init.d/tomcat
      # chkconfig --add tomcat`


      But after restarting the CentOS 6.6, the service is not running.



      Testing:



      $ echo $JAVA_HOME
      $

      $ echo $PATH
      /usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/IntUser/bin
      $


      In other words $JAVA_HOME and $PATH aren't assigned!!!



      Trying to start manually (I did not assign password to tomcat user, which password should I use?):



      $ service tomcat start
      Password:
      /bin/su: incorrect password
      $


      Running as root, I was checking:



      # service tomcat start
      This account is currently not available.
      #


      Checking the account:



      # finger tomcat
      Login: tomcat Name: Tomcat User
      Directory: /usr/local/tomcat Shell: /sbin/nologin
      Never logged in.
      No mail.
      No Plan.
      #


      # more /etc/passwd | grep tomcat
      tomcat:x:493:490:Tomcat User:/usr/local/tomcat:/sbin/nologin
      #


      Checking the ownership:



      # ls -al /usr/local/tomcat/
      total 120
      drwxr-xr-x. 9 tomcat tomcat 4096 Jun 27 09:29 .
      drwxr-xr-x. 20 root root 4096 Jun 27 09:29 ..
      drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 09:29 bin
      drwxr-xr-x. 3 tomcat tomcat 4096 Jun 27 11:04 conf
      drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 09:29 lib
      -rw-r--r--. 1 tomcat tomcat 56977 May 19 15:03 LICENSE
      drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 11:04 logs
      -rw-r--r--. 1 tomcat tomcat 1397 May 19 15:03 NOTICE
      -rw-r--r--. 1 tomcat tomcat 6741 May 19 15:03 RELEASE-NOTES
      -rw-r--r--. 1 tomcat tomcat 16204 May 19 15:03 RUNNING.txt
      drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 09:29 temp
      drwxr-xr-x. 7 tomcat tomcat 4096 May 19 15:00 webapps
      drwxr-xr-x. 3 tomcat tomcat 4096 Jun 27 11:04 work
      #


      Please help me.



      Question 1:
      The script was created in: /etc/init.d/tomcat. Why were $JAVA_HOME and $PATH not assigned?



      Question 2
      Is there a method to install a service without root privileges, that starts at boot time without intervention (e.g., sudo, su, etc)?










      share|improve this question
















      I want to install tomcat 8 and run it at startup time



      I am following these tutorials:



      1. Install Tomcat 7 on CentOS, RHEL, or Fedora

      2. How to install Tomcat 8 on a CentOS 6 VPS

      I created the tomcat user:



      # useradd -U -r -M -d /usr/local/ServerWeb/tomcat -s /sbin/nologin tomcat


      The file was in /etc/init.d/tomcat



      In the option 1:



      #!/bin/bash 
      # description: Tomcat Start Stop Restart
      # processname: tomcat
      # chkconfig: 234 20 80
      JAVA_HOME=/opt/jdk
      export JAVA_HOME
      PATH=$JAVA_HOME/bin:$PATH
      export PATH
      TOMCAT_HOME=/usr/local/tomcat
      TOMCAT_USER=tomcat

      case $1 in
      start)
      /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
      ;;
      stop)
      /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
      ;;
      restart)
      /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
      /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
      ;;
      esac
      exit 0


      In the Option 2:



      #!/bin/bash
      #
      # tomcat
      #
      # chkconfig: - 80 20
      #
      ### BEGIN INIT INFO
      # Provides: tomcat
      # Required-Start: $network $syslog
      # Required-Stop: $network $syslog
      # Default-Start:
      # Default-Stop:
      # Description: Tomcat
      # Short-Description: start and stop tomcat
      ### END INIT INFO

      ## Source function library.
      #. /etc/rc.d/init.d/functions
      export JAVA_HOME=/opt/jdk
      export JAVA_OPTS="-Dfile.encoding=UTF-8
      -Dnet.sf.ehcache.skipUpdateCheck=true
      -XX:+UseConcMarkSweepGC
      -XX:+CMSClassUnloadingEnabled
      -XX:+UseParNewGC
      -XX:MaxPermSize=128m
      -Xms512m -Xmx512m"
      export PATH=$JAVA_HOME/bin:$PATH
      TOMCAT_HOME=/usr/local/tomcat
      TOMCAT_USER=tomcat
      SHUTDOWN_WAIT=20

      tomcat_pid() grep -v grep

      start()
      pid=$(tomcat_pid)
      if [ -n "$pid" ]
      then
      echo "Tomcat is already running (pid: $pid)"
      else
      # Start tomcat
      echo "Starting tomcat"
      ulimit -n 100000
      umask 007
      /bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
      fi


      return 0


      stop()
      pid=$(tomcat_pid)
      if [ -n "$pid" ]
      then
      echo "Stoping Tomcat"
      /bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh

      let kwait=$SHUTDOWN_WAIT
      count=0;
      until [ `ps -p $pid

      case $1 in
      start)
      start
      ;;
      stop)
      stop
      ;;
      restart)
      stop
      start
      ;;
      status)
      pid=$(tomcat_pid)
      if [ -n "$pid" ]
      then
      echo "Tomcat is running with pid: $pid"
      else
      echo "Tomcat is not running"
      fi
      ;;
      esac
      exit 0


      I don't understand why this is needed in the start of option 2:



      ulimit -n 100000
      umask 007


      I changed the ownership with chown -Rvh tomcat: /usr/local/tomcat/



      Later



      # chmod +x /etc/init.d/tomcat
      # chkconfig --add tomcat`


      But after restarting the CentOS 6.6, the service is not running.



      Testing:



      $ echo $JAVA_HOME
      $

      $ echo $PATH
      /usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/IntUser/bin
      $


      In other words $JAVA_HOME and $PATH aren't assigned!!!



      Trying to start manually (I did not assign password to tomcat user, which password should I use?):



      $ service tomcat start
      Password:
      /bin/su: incorrect password
      $


      Running as root, I was checking:



      # service tomcat start
      This account is currently not available.
      #


      Checking the account:



      # finger tomcat
      Login: tomcat Name: Tomcat User
      Directory: /usr/local/tomcat Shell: /sbin/nologin
      Never logged in.
      No mail.
      No Plan.
      #


      # more /etc/passwd | grep tomcat
      tomcat:x:493:490:Tomcat User:/usr/local/tomcat:/sbin/nologin
      #


      Checking the ownership:



      # ls -al /usr/local/tomcat/
      total 120
      drwxr-xr-x. 9 tomcat tomcat 4096 Jun 27 09:29 .
      drwxr-xr-x. 20 root root 4096 Jun 27 09:29 ..
      drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 09:29 bin
      drwxr-xr-x. 3 tomcat tomcat 4096 Jun 27 11:04 conf
      drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 09:29 lib
      -rw-r--r--. 1 tomcat tomcat 56977 May 19 15:03 LICENSE
      drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 11:04 logs
      -rw-r--r--. 1 tomcat tomcat 1397 May 19 15:03 NOTICE
      -rw-r--r--. 1 tomcat tomcat 6741 May 19 15:03 RELEASE-NOTES
      -rw-r--r--. 1 tomcat tomcat 16204 May 19 15:03 RUNNING.txt
      drwxr-xr-x. 2 tomcat tomcat 4096 Jun 27 09:29 temp
      drwxr-xr-x. 7 tomcat tomcat 4096 May 19 15:00 webapps
      drwxr-xr-x. 3 tomcat tomcat 4096 Jun 27 11:04 work
      #


      Please help me.



      Question 1:
      The script was created in: /etc/init.d/tomcat. Why were $JAVA_HOME and $PATH not assigned?



      Question 2
      Is there a method to install a service without root privileges, that starts at boot time without intervention (e.g., sudo, su, etc)?







      centos software-installation startup tomcat






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 25 '15 at 16:47









      Thomas Dickey

      54.2k5106180




      54.2k5106180










      asked Jun 29 '15 at 16:46









      QA_ColQA_Col

      210411




      210411





      bumped to the homepage by Community yesterday


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community yesterday


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Neither of the tutorials you mentioned suggest using useradd with all of those options. By setting the login shell to /sbin/nologin you encounter:



          incorrect password 


          and



          This account is currently not available


          The following command will cause tomcat to be a system account without a /home/tomcat directory:



          useradd -r tomcat --shell /bin/false


          And this command will create a non-system tomcat account with a /home/tomcat directory:



          useradd tomcat --shell /bin/false


          EDIT:



          You are correct about the similarities of /sbin/nologin and /bin/false. The install instructions from Option #2 in the OP seem to be somewhat incomplete. I suggest using just one set of instructions until tomcat is working.



          This is the Tomcat 8 version of Option #1 you provided. I suggest using only these instructions to get your installation working. (It looks like mixing and matching is causing some grief.) By doing this, you will avoid other issues like your $JAVA_HOME and $PATH not being exported (Question 1) and Question 2 will be answered as well.



          Notice in your Option #1 script, you have lines like this:



          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh


          However the Option #1 link you provided has these lines:



          sh $CATALINA_HOME/bin/startup.sh 
          sh $CATALINA_HOME/bin/shutdown.sh
          sh $CATALINA_HOME/bin/shutdown.sh
          sh $CATALINA_HOME/bin/startup.sh





          share|improve this answer

























          • Thank you, Is bad idea to use --shell /bin/false ? and with creating the account -r is better to use System account or not?

            – QA_Col
            Jun 29 '15 at 22:31












          • This does a great job of explaining /sbin/nologin and /bin/false. As for -r or not, perhaps someone else can answer.

            – Timothy Martin
            Jun 29 '15 at 23:30












          • I was check your link your post and it has the same effect (only the difference is the additional message for -s /sbin/nologin). And Option 2 uses # useradd -r tomcat8 --shell /bin/false ... In other words -s /sbin/nologin or --shell /bin/false will cause the same problem. This post shows this.

            – QA_Col
            Jun 30 '15 at 1:30











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f212904%2fstarting-tomcat-service-when-starting-centos-rhel-fedora%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Neither of the tutorials you mentioned suggest using useradd with all of those options. By setting the login shell to /sbin/nologin you encounter:



          incorrect password 


          and



          This account is currently not available


          The following command will cause tomcat to be a system account without a /home/tomcat directory:



          useradd -r tomcat --shell /bin/false


          And this command will create a non-system tomcat account with a /home/tomcat directory:



          useradd tomcat --shell /bin/false


          EDIT:



          You are correct about the similarities of /sbin/nologin and /bin/false. The install instructions from Option #2 in the OP seem to be somewhat incomplete. I suggest using just one set of instructions until tomcat is working.



          This is the Tomcat 8 version of Option #1 you provided. I suggest using only these instructions to get your installation working. (It looks like mixing and matching is causing some grief.) By doing this, you will avoid other issues like your $JAVA_HOME and $PATH not being exported (Question 1) and Question 2 will be answered as well.



          Notice in your Option #1 script, you have lines like this:



          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh


          However the Option #1 link you provided has these lines:



          sh $CATALINA_HOME/bin/startup.sh 
          sh $CATALINA_HOME/bin/shutdown.sh
          sh $CATALINA_HOME/bin/shutdown.sh
          sh $CATALINA_HOME/bin/startup.sh





          share|improve this answer

























          • Thank you, Is bad idea to use --shell /bin/false ? and with creating the account -r is better to use System account or not?

            – QA_Col
            Jun 29 '15 at 22:31












          • This does a great job of explaining /sbin/nologin and /bin/false. As for -r or not, perhaps someone else can answer.

            – Timothy Martin
            Jun 29 '15 at 23:30












          • I was check your link your post and it has the same effect (only the difference is the additional message for -s /sbin/nologin). And Option 2 uses # useradd -r tomcat8 --shell /bin/false ... In other words -s /sbin/nologin or --shell /bin/false will cause the same problem. This post shows this.

            – QA_Col
            Jun 30 '15 at 1:30















          0














          Neither of the tutorials you mentioned suggest using useradd with all of those options. By setting the login shell to /sbin/nologin you encounter:



          incorrect password 


          and



          This account is currently not available


          The following command will cause tomcat to be a system account without a /home/tomcat directory:



          useradd -r tomcat --shell /bin/false


          And this command will create a non-system tomcat account with a /home/tomcat directory:



          useradd tomcat --shell /bin/false


          EDIT:



          You are correct about the similarities of /sbin/nologin and /bin/false. The install instructions from Option #2 in the OP seem to be somewhat incomplete. I suggest using just one set of instructions until tomcat is working.



          This is the Tomcat 8 version of Option #1 you provided. I suggest using only these instructions to get your installation working. (It looks like mixing and matching is causing some grief.) By doing this, you will avoid other issues like your $JAVA_HOME and $PATH not being exported (Question 1) and Question 2 will be answered as well.



          Notice in your Option #1 script, you have lines like this:



          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh


          However the Option #1 link you provided has these lines:



          sh $CATALINA_HOME/bin/startup.sh 
          sh $CATALINA_HOME/bin/shutdown.sh
          sh $CATALINA_HOME/bin/shutdown.sh
          sh $CATALINA_HOME/bin/startup.sh





          share|improve this answer

























          • Thank you, Is bad idea to use --shell /bin/false ? and with creating the account -r is better to use System account or not?

            – QA_Col
            Jun 29 '15 at 22:31












          • This does a great job of explaining /sbin/nologin and /bin/false. As for -r or not, perhaps someone else can answer.

            – Timothy Martin
            Jun 29 '15 at 23:30












          • I was check your link your post and it has the same effect (only the difference is the additional message for -s /sbin/nologin). And Option 2 uses # useradd -r tomcat8 --shell /bin/false ... In other words -s /sbin/nologin or --shell /bin/false will cause the same problem. This post shows this.

            – QA_Col
            Jun 30 '15 at 1:30













          0












          0








          0







          Neither of the tutorials you mentioned suggest using useradd with all of those options. By setting the login shell to /sbin/nologin you encounter:



          incorrect password 


          and



          This account is currently not available


          The following command will cause tomcat to be a system account without a /home/tomcat directory:



          useradd -r tomcat --shell /bin/false


          And this command will create a non-system tomcat account with a /home/tomcat directory:



          useradd tomcat --shell /bin/false


          EDIT:



          You are correct about the similarities of /sbin/nologin and /bin/false. The install instructions from Option #2 in the OP seem to be somewhat incomplete. I suggest using just one set of instructions until tomcat is working.



          This is the Tomcat 8 version of Option #1 you provided. I suggest using only these instructions to get your installation working. (It looks like mixing and matching is causing some grief.) By doing this, you will avoid other issues like your $JAVA_HOME and $PATH not being exported (Question 1) and Question 2 will be answered as well.



          Notice in your Option #1 script, you have lines like this:



          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh


          However the Option #1 link you provided has these lines:



          sh $CATALINA_HOME/bin/startup.sh 
          sh $CATALINA_HOME/bin/shutdown.sh
          sh $CATALINA_HOME/bin/shutdown.sh
          sh $CATALINA_HOME/bin/startup.sh





          share|improve this answer















          Neither of the tutorials you mentioned suggest using useradd with all of those options. By setting the login shell to /sbin/nologin you encounter:



          incorrect password 


          and



          This account is currently not available


          The following command will cause tomcat to be a system account without a /home/tomcat directory:



          useradd -r tomcat --shell /bin/false


          And this command will create a non-system tomcat account with a /home/tomcat directory:



          useradd tomcat --shell /bin/false


          EDIT:



          You are correct about the similarities of /sbin/nologin and /bin/false. The install instructions from Option #2 in the OP seem to be somewhat incomplete. I suggest using just one set of instructions until tomcat is working.



          This is the Tomcat 8 version of Option #1 you provided. I suggest using only these instructions to get your installation working. (It looks like mixing and matching is causing some grief.) By doing this, you will avoid other issues like your $JAVA_HOME and $PATH not being exported (Question 1) and Question 2 will be answered as well.



          Notice in your Option #1 script, you have lines like this:



          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
          /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh


          However the Option #1 link you provided has these lines:



          sh $CATALINA_HOME/bin/startup.sh 
          sh $CATALINA_HOME/bin/shutdown.sh
          sh $CATALINA_HOME/bin/shutdown.sh
          sh $CATALINA_HOME/bin/startup.sh






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jun 30 '15 at 21:50

























          answered Jun 29 '15 at 19:44









          Timothy MartinTimothy Martin

          5,4242430




          5,4242430












          • Thank you, Is bad idea to use --shell /bin/false ? and with creating the account -r is better to use System account or not?

            – QA_Col
            Jun 29 '15 at 22:31












          • This does a great job of explaining /sbin/nologin and /bin/false. As for -r or not, perhaps someone else can answer.

            – Timothy Martin
            Jun 29 '15 at 23:30












          • I was check your link your post and it has the same effect (only the difference is the additional message for -s /sbin/nologin). And Option 2 uses # useradd -r tomcat8 --shell /bin/false ... In other words -s /sbin/nologin or --shell /bin/false will cause the same problem. This post shows this.

            – QA_Col
            Jun 30 '15 at 1:30

















          • Thank you, Is bad idea to use --shell /bin/false ? and with creating the account -r is better to use System account or not?

            – QA_Col
            Jun 29 '15 at 22:31












          • This does a great job of explaining /sbin/nologin and /bin/false. As for -r or not, perhaps someone else can answer.

            – Timothy Martin
            Jun 29 '15 at 23:30












          • I was check your link your post and it has the same effect (only the difference is the additional message for -s /sbin/nologin). And Option 2 uses # useradd -r tomcat8 --shell /bin/false ... In other words -s /sbin/nologin or --shell /bin/false will cause the same problem. This post shows this.

            – QA_Col
            Jun 30 '15 at 1:30
















          Thank you, Is bad idea to use --shell /bin/false ? and with creating the account -r is better to use System account or not?

          – QA_Col
          Jun 29 '15 at 22:31






          Thank you, Is bad idea to use --shell /bin/false ? and with creating the account -r is better to use System account or not?

          – QA_Col
          Jun 29 '15 at 22:31














          This does a great job of explaining /sbin/nologin and /bin/false. As for -r or not, perhaps someone else can answer.

          – Timothy Martin
          Jun 29 '15 at 23:30






          This does a great job of explaining /sbin/nologin and /bin/false. As for -r or not, perhaps someone else can answer.

          – Timothy Martin
          Jun 29 '15 at 23:30














          I was check your link your post and it has the same effect (only the difference is the additional message for -s /sbin/nologin). And Option 2 uses # useradd -r tomcat8 --shell /bin/false ... In other words -s /sbin/nologin or --shell /bin/false will cause the same problem. This post shows this.

          – QA_Col
          Jun 30 '15 at 1:30





          I was check your link your post and it has the same effect (only the difference is the additional message for -s /sbin/nologin). And Option 2 uses # useradd -r tomcat8 --shell /bin/false ... In other words -s /sbin/nologin or --shell /bin/false will cause the same problem. This post shows this.

          – QA_Col
          Jun 30 '15 at 1:30

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f212904%2fstarting-tomcat-service-when-starting-centos-rhel-fedora%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          -centos, software-installation, startup, tomcat

          Popular posts from this blog

          Mobil Contents History Mobil brands Former Mobil brands Lukoil transaction Mobil UK Mobil Australia Mobil New Zealand Mobil Greece Mobil in Japan Mobil in Canada Mobil Egypt See also References External links Navigation menuwww.mobil.com"Mobil Corporation"the original"Our Houston campus""Business & Finance: Socony-Vacuum Corp.""Popular Mechanics""Lubrite Technologies""Exxon Mobil campus 'clearly happening'""Toledo Blade - Google News Archive Search""The Lion and the Moose - How 2 Executives Pulled off the Biggest Merger Ever""ExxonMobil Press Release""Lubricants""Archived copy"the original"Mobil 1™ and Mobil Super™ motor oil and synthetic motor oil - Mobil™ Motor Oils""Mobil Delvac""Mobil Industrial website""The State of Competition in Gasoline Marketing: The Effects of Refiner Operations at Retail""Mobil Travel Guide to become Forbes Travel Guide""Hotel Rankings: Forbes Merges with Mobil"the original"Jamieson oil industry history""Mobil news""Caltex pumps for control""Watchdog blocks Caltex bid""Exxon Mobil sells service station network""Mobil Oil New Zealand Limited is New Zealand's oldest oil company, with predecessor companies having first established a presence in the country in 1896""ExxonMobil subsidiaries have a business history in New Zealand stretching back more than 120 years. We are involved in petroleum refining and distribution and the marketing of fuels, lubricants and chemical products""Archived copy"the original"Exxon Mobil to Sell Its Japanese Arm for $3.9 Billion""Gas station merger will end Esso and Mobil's long run in Japan""Esso moves to affiliate itself with PC Optimum, no longer Aeroplan, in loyalty point switch""Mobil brand of gas stations to launch in Canada after deal for 213 Loblaws-owned locations""Mobil Nears Completion of Rebranding 200 Loblaw Gas Stations""Learn about ExxonMobil's operations in Egypt""Petrol and Diesel Service Stations in Egypt - Mobil"Official websiteExxon Mobil corporate websiteMobil Industrial official websiteeeeeeeeDA04275022275790-40000 0001 0860 5061n82045453134887257134887257

          Frič See also Navigation menuinternal link

          Identify plant with long narrow paired leaves and reddish stems Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?What is this plant with long sharp leaves? Is it a weed?What is this 3ft high, stalky plant, with mid sized narrow leaves?What is this young shrub with opposite ovate, crenate leaves and reddish stems?What is this plant with large broad serrated leaves?Identify this upright branching weed with long leaves and reddish stemsPlease help me identify this bulbous plant with long, broad leaves and white flowersWhat is this small annual with narrow gray/green leaves and rust colored daisy-type flowers?What is this chilli plant?Does anyone know what type of chilli plant this is?Help identify this plant