This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#======================================================================== | |
# Apache and Tomcat Start, Stop | |
#======================================================================== | |
# Apache # | |
apacheInvoker="/etc/init.d/httpd" | |
apacheTargetLog="/usr/local/apache/logs/error_log" | |
# Tomcat # | |
tomcatInvoker="/etc/init.d/${tomcat}" | |
tomcatWebappsPath="/usr/local/${tomcat}/webapps" | |
tomcatOtherWebappsPath="/usr/local/${tomcat}/${webapp}" | |
tomcatTargetLog="/usr/local/${tomcat}/logs/catalina.out" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#======================================== | |
# goal : Start apache | |
# prameter : | |
# 1.expectPath | |
# 2.expectTimeOut | |
# 3.adminUserId | |
# 4.ip | |
# 5.sudoPath | |
# 6.apacheInvoker | |
# 7.tailPath | |
# 8.tailOption | |
# 9.apacheTargetLog | |
#======================================== | |
apacheStart(){ | |
echo "Attempt to startup apache..." | |
${expectPath} <<EOF | |
set timeout ${expectTimeOut} | |
spawn ssh ${adminUserId}@$ip | |
expect "Last login:" | |
send "${sudoPath} ${apacheInvoker} start\r" | |
expect "resuming normal operations" | |
send "${tailPath} ${tailOption} ${apacheTargetLog}\r" | |
expect "OK. Normally startup." | |
close | |
EOF | |
} | |
#======================================== | |
# goal : Stop apache | |
# prameter : | |
# 1.expectPath | |
# 2.expectTimeOut | |
# 3.adminUserId | |
# 4.ip | |
# 5.sudoPath | |
# 6.apacheInvoker | |
# 7.tailPath | |
# 8.tailOption | |
# 9.apacheTargetLog | |
#======================================== | |
apacheStop(){ | |
echo "Attempt to shutdown apache..." | |
${expectPath} <<EOF | |
set timeout ${expectTimeOut} | |
spawn ssh ${adminUserId}@$ip | |
expect "Last login:" | |
send "${sudoPath} ${apacheInvoker} stop\r" | |
expect "shutting down" | |
send "${tailPath} ${tailOption} ${apacheTargetLog}\r" | |
expect "OK. Normally shut down" | |
close | |
EOF | |
} | |
#======================================== | |
# goal : Start tomcat | |
# prameter : | |
# 1.expectPath | |
# 2.expectTimeOut | |
# 3.adminUserId | |
# 4.ip | |
# 5.sudoPath | |
# 6.tomcatInvoker | |
# 7.tailPath | |
# 8.tailOption | |
# 9.targetLog | |
# 10.expectLog | |
#======================================== | |
tomcatStart(){ | |
echo "Attempt to startup tomcat..." | |
${expectPath} <<EOF | |
set timeout ${expectTimeOut} | |
spawn ssh ${adminUserId}@$ip | |
expect "Last login:" | |
send "${sudoPath} ${tomcatInvoker} start\r" | |
expect "Using JRE_HOME:" | |
send "${tailPath} ${tailOption} ${tomcatTargetLog}\r" | |
expect "Server startup" | |
close | |
EOF | |
} | |
#======================================== | |
# goal : Stop tomcat | |
# prameter : | |
# 1.expectPath | |
# 2.expectTimeOut | |
# 3.adminUserId | |
# 4.ip | |
# 5.sudoPath | |
# 6.tomcatInvoker | |
# 7.tailPath | |
# 8.tailOption | |
# 9.targetLog | |
# 10.expectTomcatLog | |
#======================================== | |
tomcatStop(){ | |
echo "Attempt to shutdown tomcat..." | |
${expectPath} <<EOF | |
set timeout ${expectTimeOut} | |
spawn ssh ${adminUserId}@$ip | |
expect "Last login:" | |
send "${sudoPath} ${tomcatInvoker} stop\r" | |
expect "Using JRE_HOME:" | |
send "${tailPath} ${tailOption} ${tomcatTargetLog}\r" | |
expect "${expectTomcatLog}" | |
close | |
EOF | |
} |
No comments:
Post a Comment