简体   繁体   English

如何从另一个Shell脚本运行Shell脚本

[英]How run a shell script from another shell script

I have recently install tomcat8 on Ubuntu. 我最近在Ubuntu上安装了tomcat8。 It is located at /opt/tomcat/apache-tomcat-8.0.36/bin and need to run ./shutdown.sh and ./startup.sh manually. 它位于/opt/tomcat/apache-tomcat-8.0.36/bin中,需要手动运行./shutdown.sh和./startup.sh。 Can anybody suggest me a shell scrip that can do startup, shutdown and even restart servers ? 有人可以建议我一个可以启动,关闭甚至重新启动服务器的shell脚本吗? Thanks in advance. 提前致谢。

this can help you 这可以帮助你

#!/bin/bash
start() {
/opt/tomcat/apache-tomcat-8.0.36/bin/startup.sh  
}

stop() {
/opt/tomcat/apache-tomcat-8.0.36/bin/shutdown.sh 
}

case "$1" in 
    start)
       start
       ;;
    stop)
       stop
       ;;
    restart)
       stop
       start
       ;;
    *)
       echo "Usage: $0 {start|stop|restart}"
esac

exit 0 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM