重启tomcat脚本

阅读更多
这只是针对文件型系统来说(solaris/linux)
在文件中写上:
#!/bin/bash
#
# tomcat       Starts Tomcat Java server.
#
#
# chkconfig: 345 88 12
# description: Tomcat is the server for Java servlet applications.
### BEGIN INIT INFO
# Provides: $tomcat
### END INIT INFO

# Source function library.
# . /etc/init.d/functions

# [ -f /home/tomcat/tcstart.sh ] || exit 0
# [ -f /home/tomcat/tcstop.sh ] || exit 0
[ -f /tomcat/bin/startup.sh ] || exit 0
[ -f /tomcat/bin/shutdown.sh ] || exit 0

RETVAL=0

umask 077

start(); {
        echo -n $"Starting Tomcat Java server: "
#       daemon su -c /home/tomcat/tcstart.sh tomcat
 				/tomcat/bin/startup.sh
        echo
        return $RETVAL
}
stop(); {
        echo -n $"Shutting down Tomcat Java server: "
#       daemon su -c /home/tomcat/tcstop.sh tomcat
				/tomcat/bin/shutdown.sh
        echo
        return $RETVAL
}
restart(); {
        stop
        start
}
case "$1" in
  start);
        start
        ;;
  stop);
        stop
        ;;
  restart|reload);
        restart
        ;;
  *);
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
esac

exit

然后保存后,并赋予这个文件的可执行权限。
chmod  -x(可执行)/w(写)/r(读) 文件名

你可能感兴趣的:(Tomcat,脚本,Java,Linux,Solaris)