我正在使用Amazon Linux AMI并对其进行一些自定义修改(添加了axis2server等)并将其保存为新的AMI.现在我想要做的是当AMI启动时,启动axis2server(ie.saxis2server应该在实例启动时自动启动).为此,我使用了如下的init脚本并运行以下命令:
chkconfig --add axisservice
Run Code Online (Sandbox Code Playgroud)
但是当我从我的图像中启动一个新实例时,axis2server还没有开始.
我只需要在启动时执行脚本/home/ec2-user/axis2-1.6.1/bin/axis2server.sh.我在这里错过了什么吗?
#! /bin/sh
# Basic support for IRIX style chkconfig
###
# chkconfig: 235 98 55
# description: Manages the services you are controlling with the chkconfig command
###
case "$1" in
start)
echo -n "Starting axisservice"
touch ~/temp.txt
cd /home/ec2-user/axis2-1.6.1/bin
./axis2server.sh &
echo "."
;;
stop)
echo -n "Stopping axisservice"
echo "."
;;
*)
echo "Usage: /sbin/service axisservice {start|stop}"
exit 1
esac
exit 0
Run Code Online (Sandbox Code Playgroud)
我还浏览了https://help.ubuntu.com/community/CloudInit,它提供了一种名为User-Data Scripts的机制,用户可以在启动脚本时执行脚本.
$ euca-run-instances --key mykey …Run Code Online (Sandbox Code Playgroud) 在我的项目的构建(编译)时,我需要为java类进行代码生成.生成的java类是一个带有一组getter和setter的java bean类.在构建时,我得到类的名称和变量的名称.所以我需要做的是从我拥有的信息中动态生成java bean.
例如.在编译时我得到了以下数据.
class-name=Test
variable-name=aaa
Run Code Online (Sandbox Code Playgroud)
所以generate类应该如下所示.
public class Test {
public String aaa;
public void setVar(String str) {
this.aaa = str;
}
public String getVar(){
return this.aaa;
}
}
Run Code Online (Sandbox Code Playgroud)
当我搜索一个我可以使用的工具时,我发现Arch4j [1]很有趣,但问题是它与Apache 2.0许可证不兼容.我正在寻找一个与Apache 2.0许可证兼容的项目/工具.
如果有人能给我一些关于如何做到这一点的见解,我将不胜感激.
[1] - http://arch4j.sourceforge.net/components/generator/index.html