1 Star 0 Fork 4K

老和部队/O2OA

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
service_linux.sh 1.08 KB
一键复制 编辑 原始数据 按行查看 历史
rooo000 提交于 2022-02-25 16:16 +08:00 . 添加输出到null
current_dir="$(
cd "$(dirname "$0")"
pwd
)"
if [ -z "$1" ]; then
echo "usage: ./service_linux.sh name [start.sh default is start_linux.sh]"
exit
fi
name="$1"
scriptName="start_linux.sh"
if [ -z "$2" ]; then
echo "use ${current_dir}/${scriptName} as start script."
else
scriptName="$2"
fi
if [ ! -f ${current_dir}/${scriptName} ]; then
echo "start script ${current_dir}/${scriptName} not exist."
exit
fi
servicePath="/etc/systemd/system/${name}.service"
echo "[Unit]" >${servicePath}
echo "Description=o2server name:${name}" >>${servicePath}
echo "Wants=network-online.target" >>${servicePath}
echo "After=network.target" >>${servicePath}
echo "[Service]" >>${servicePath}
echo "Type=simple" >>${servicePath}
echo "StandardOutput=null" >>${servicePath}
echo "StandardError=null" >>${servicePath}
echo "ExecStart=${current_dir}/${scriptName}" >>${servicePath}
echo "ExecReload=${current_dir}/restart_linux.sh" >>${servicePath}
echo "ExecStop=${current_dir}/stop_linux.sh" >>${servicePath}
echo "[Install]" >>${servicePath}
echo "WantedBy=multi-user.target" >>${servicePath}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/longlx/O2OA.git
git@gitee.com:longlx/O2OA.git
longlx
O2OA
O2OA
develop

搜索帮助