标签:style blog http io ar color os sp java
1 编写启动文件/etc/init.d/tomcat7 文件内容如下:
#!/bin/sh #注意第一句#!/bin/sh如果不写,就不是一个shell文件 #tomcat auto-start #export JAVA_HOME=/usr/lib/jdk/ #已经在/etc/profile里配置过 case $1 in start) sh /usr/local/tomcat/bin/startup.sh #tomcat的启动文件 ;; stop) sh /usr/local/tomcat/bin/shutdown.sh ;; restart) sh /usr/local/tomcat/bin/shutdown.sh sh /usr/local/tomcat/bin/startup.sh ;; *) echo ‘Usage:tomcat7 start|stop|restart‘ ;; esac exit 0
2 把/etc/init.d/tomcat7设置成可执行:
sudo chmod +x /etc/init.d/tomcat7
3 将tomcat7加入服务:
sudo update-rc.d tomcat7 defaults
我的ubuntu输入之后输出的结果:
update-rc.d: warning: /etc/init.d/tomcat7 missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
Adding system startup for /etc/init.d/tomcat7 ...
/etc/rc0.d/K20tomcat7 -> ../init.d/tomcat7
/etc/rc1.d/K20tomcat7 -> ../init.d/tomcat7
/etc/rc6.d/K20tomcat7 -> ../init.d/tomcat7
/etc/rc2.d/S20tomcat7 -> ../init.d/tomcat7
/etc/rc3.d/S20tomcat7 -> ../init.d/tomcat7
/etc/rc4.d/S20tomcat7 -> ../init.d/tomcat7
/etc/rc5.d/S20tomcat7 -> ../init.d/tomcat7
好了,重启电脑就差不多了。
标签:style blog http io ar color os sp java
原文地址:http://www.cnblogs.com/jecyhw/p/4125621.html