Ask a question about ilnux variable output

Source: Internet
Author: User
Ask a question about the output of ilnux variables-general Linux technology-Linux technology and application information. The following is a detailed description. Hello, linux enthusiasts. I have written two scripts for one question.
Script1
#! /Bin/bash
Echo $ PATH>/root/vms. log
Declare-I dbcount
Dbcount = '/bin/netstat-ant | grep '000000' | grep EST | wc-l'
Echo "$ dbcount">/root/vms. log
If ["$ dbcount"-ge "90"]; then
USER = root
JAVA_HOME =/usr/java/jdk1.5.0 _ 10
TOMCAT_HOME =/usr/local/tomcat5
CATALINA_BASH = $ TOMCAT_HOME
CATALINA_HOME = $ TOMCAT_HOME
JRE =/usr/java/jdk1.5.0 _ 10/jre
CLASSPATH = $ JAVA_HOME/lib: $ JRE/lib :.
PATH = $ JAVA_HOME/bin: $ JRE/bin: $ PATH.
Export JAVA_HOME jre classpath path TOMCAT_HOME CATALINA_BASH CATALINA_HOME
LANG = "zh_CN.GB18030"
Echo $ PATH>/root/vms. log
I = '/bin/ps-e | grep java | awk' {print $1 }''
/Bin/date>/root/kill. log
/Bin/echo $ I>/root/kill. log
/Bin/kill-9 $ I
/Bin/sleep 15
/Usr/local/tomcat5/bin/startup. sh
/Bin/sleep 15
/Bin/ps-e | grep java>/root/kill. log
Else
Exit
Fi
-----------------------------------------------------------------
Script2

#! /Bin/bash
Echo $ PATH>/root/vms. log
USER = root
JAVA_HOME =/usr/java/jdk1.5.0 _ 10 -----
TOMCAT_HOME =/usr/local/tomcat5
CATALINA_BASH = $ TOMCAT_HOME
CATALINA_HOME = $ TOMCAT_HOME
JRE =/usr/java/jdk1.5.0 _ 10/jre
CLASSPATH = $ JAVA_HOME/lib: $ JRE/lib :.
PATH = $ JAVA_HOME/bin: $ JRE/bin: $ PATH.
Export JAVA_HOME jre classpath path TOMCAT_HOME CATALINA_BASH CATALINA_HOME
LANG = "zh_CN.GB18030"
Echo $ PATH>/root/vms. log
Declare-I dbcount
Dbcount = '/bin/netstat-ant | grep '000000' | grep EST | wc-l'
Echo "$ dbcount">/root/vms. log
If ["$ dbcount"-ge "90"]; then
I = '/bin/ps-e | grep java | awk' {print $1 }''
/Bin/date>/root/kill. log
/Bin/echo $ I>/root/kill. log
/Bin/kill-9 $ I
/Bin/sleep 15
/Usr/local/tomcat5/bin/startup. sh
/Bin/sleep 15
/Bin/ps-e | grep java>/root/kill. log
Else
Exit
Fi
--------------------------------------------
After I add two scripts to crontab, it is normal for script1 to output dbcount, and script2 is 0. Why can't I find it? Thank you for your analysis.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.