nano /root/start
#!/bin/sh
cd /root/workspace/start
./start.sh
加上权限chmod 777 /root/start
创建文件nano /root/workspace/start/start.sh
内容如下
#!/bin/sh
ant start
编辑这个文件
nano /etc/rc.local
加入
/root/start
重启测试
在/root下创建一个文件
nano installKey
内容如下
cd /root/workspace/install
./install.sh
保存文件
给文件附上权限
chmod 777 installKey
在编辑install.sh文件
nano /root/workspace/install/install.sh
内容如下
#!/bin/sh
ant stop
ant install
给文件附上权限
chmod 777 /root/workspace/install/install.sh
测试
./installKey
成功执行install.sh中的命令
#!/bin/sh
cd /root/workspace/start
./start.sh
加上权限chmod 777 /root/start
创建文件nano /root/workspace/start/start.sh
内容如下
#!/bin/sh
ant start
编辑这个文件
nano /etc/rc.local
加入
/root/start
重启测试
在/root下创建一个文件
nano installKey
内容如下
cd /root/workspace/install
./install.sh
保存文件
给文件附上权限
chmod 777 installKey
在编辑install.sh文件
nano /root/workspace/install/install.sh
内容如下
#!/bin/sh
ant stop
ant install
给文件附上权限
chmod 777 /root/workspace/install/install.sh
测试
./installKey
成功执行install.sh中的命令
本文介绍了一种使用Shell脚本来实现自动化部署的方法。通过创建并配置特定的Shell脚本,可以轻松地启动、停止和安装应用程序。具体步骤包括设置脚本路径、赋予执行权限及在系统启动时自动运行。
729

被折叠的 条评论
为什么被折叠?



