【发布时间】:2013-12-07 15:31:05
【问题描述】:
我正在尝试使用 upstart 在 Ubuntu 12.10 上为 tomcat 创建服务。
所以,我在 /etc/init 中创建了一个 tomcat.conf 文件
description "Tomcat Server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
# run as non privileged user
# add user with this command:
## adduser --system --ingroup www-data --home /opt/apache-tomcat apache-tomcat
# Ubuntu 12.04: (use 'exec sudo -u apache-tomcat' when using 10.04)
setuid tomcat
setgid tomcat
pre-start script
. /etc/default/tomcat
end script
exec $CATALINA_HOME/bin/catalina.sh run
# cleanup temp directory after stop
post-stop script
rm -rf $CATALINA_HOME/temp/*
end script
/etc/default/tomcat 文件包含环境变量,我需要在启动服务之前设置。
但是,获取文件没有任何效果。当我从命令行获取 /etc/default/tomcat 文件时,它工作正常。但是当我将它包含在脚本中时,它没有任何效果。
可能出了什么问题?
【问题讨论】:
标签: ubuntu service upstart ubuntu-12.10