tomcat automaticaly stop in menu script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting tomcat automaticaly stop in menu script
# 1  
Old 03-29-2011
tomcat automaticaly stop in menu script

i have a problem with the code I created (see below).

a. when I logged in as root and su to tomcat, i can execute all options. when I press X, it will exit properly.
b. when I logged in directly as user1, I can execute also all options. if I press X i will logout automatically to putty. However I noticed that if I exit, tomcat process also stop when I run ps -ef | grep tomcat

I do not know why is that happening if I logged in directly and exit

user1 :/home/user1:/home/user1/script.sh
Code:
#!/bin/sh

TOMCATDIR=/home/tomcat/apache-tomcat/bin/

menu() {
    done0=n
    while [ "$done0" != "y" ]; do
    clear
        cat <<EOF
          
                        [1] Stop app1
                        [2] Start app2
                        [3] View tomcat process

                        [X] Exit
            

EOF
    printf "           Enter your option =>> "
    read choice
    case "$choice" in
        1) startapp;;
        2) stopapp;;
        3) viewapp;;
        x|X) done0=y;;
    esac
    done
    clear
}

stopmrs() {
        echo "Stopping Tomcat "
        sudo su - tomcat $TOMCATDIR/shutdown.sh
        echo "Press enter to continue."
        read enterkey
}

startmrs() {
         echo "Starting Tomcat"
         sudo  su - tomcat $TOMCATDIR/startup.sh
         echo "Press enter to continue."
         read enterKey
}

menu

# 2  
Old 03-29-2011
I doubt the options would work since you call
startapp
stopapp
viewapp

whereas your function names are
stopmrs
startmrs
... and "viewrms" doesn't exist.

(or we don't have all the infos)
# 3  
Old 03-29-2011
sorry just a typo error. when I logout the tomcat also stop..logout Im out also on putty/
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Script monitor website wth default tomcat script

Hi all, on our application server we have the following script that monitor the status of the website, my problem here is that i have edite the retries from 3 to 5, and the timewait to 120 second, so the script should check 5 times every 2 minutes, and if the fifth check fails it must restart... (0 Replies)
Discussion started by: charli1
0 Replies

2. Shell Programming and Scripting

Montioring Script Tomcat catalina.out

Hi, I need to monitor the tomcat log file called "Catalina.out" for any errors like out of memory,JDBC exceptions,broken pipe any other errors and exceptions The script should monitor this file and send a mail instantly and create a text file with errors day to day. Iam using Solaris... (3 Replies)
Discussion started by: chaithanyaa
3 Replies

3. Shell Programming and Scripting

How can i su automaticaly in same server with different username and same password?

Hi I am new to shell scripting, Can you please help me in writing a script that can switch user in same server with different user name and same password. I want to perform some functional task in a particular user and need to switch user and perform same activity in another user and so on ... ... (4 Replies)
Discussion started by: Dew
4 Replies

4. Shell Programming and Scripting

Monitoring Tomcat Service with shell script

Hello Forum, I have prepared script to monitor the tomcat status. Following is the script which will monitor tomcat instance. I need little modifcation in the script. My script will grep for process, the output of grep command will analyze by if condition under for loop and will send... (2 Replies)
Discussion started by: ooilinlove
2 Replies

5. Solaris

Tomcat..Unable to deploy application remotely in tomcat

Hi, We have upgrade tomcat from 5.0.20 to 7.0.33 and made changes to server.xml file according to newer version.. how ever the upgrade went fine and now i am unable to deploy application remotely.. it is giving 403 access denied error.. we have seperate appbase directory mentioned in server.xml..... (0 Replies)
Discussion started by: phani4u
0 Replies

6. Shell Programming and Scripting

Menu in Menu script issue

Problem: I am trying to create a menu in a menu script and I am running into an issue with the calculator portion of the script. I am first presented with the ==Options Menu== which all 5 options working correctly. Now comes the fun part. I select option 1 which takes me to my ==Calculator... (1 Reply)
Discussion started by: iDdraig
1 Replies

7. Shell Programming and Scripting

Monitoring Tomcat Instance using shell script

Hello Forum, I have prepared script to monitor the tomcat status. Following is the script which will monitor tomcat instance.I need little modifcation in the script. My script will grep for java,the output of grep command will analyze by if condition under for loop and will send following echo... (7 Replies)
Discussion started by: coolguyamy
7 Replies

8. Web Development

Allow multiple users to start/stop tomcat

Hi, I have the user who runs tomcat: tomcat:tomcats I want to have another user who will be able to start and stop tomcat process. Is this possible? Thanks, Bianca (1 Reply)
Discussion started by: potro
1 Replies

9. Shell Programming and Scripting

How to check for and start the Tomcat using a script

Hello Everyone,. I am a novice with shell scripting and have written some minor shell scripts to copy files and such that. Now I have a requirement to write a shell script to go check if Tomcat running in the same server is up or not, if not then run the Tomcat startup script. Then put this... (4 Replies)
Discussion started by: bhaire
4 Replies

10. Shell Programming and Scripting

Script for exporting FS into non global server automaticaly.

Post has been removed. Prakash K :) (0 Replies)
Discussion started by: bullz26
0 Replies
Login or Register to Ask a Question