
在 Linux 环境中TongWeb 默认一般通过 bin 目录下的脚本进行启动和停止启动./startd.sh停止./stopserver.sh这种方式每次都需要进入 TongWeb 安装目录操作如果服务器重启还需要人工启动。可以将 TongWeb 配置成 systemd 服务之后直接使用 systemctl 管理。例如systemctl start tongweb systemctl stop tongweb systemctl restart tongweb systemctl status tongweb配置 TongWeb 服务创建服务文件vim /etc/systemd/system/tongweb.service写入以下内容[Unit] DescriptionTongWeb Middleware Afternetwork.target syslog.target [Service] Typeforking WorkingDirectory/home/chenyanliang/dft/TongWeb8.0.9.12/bin EnvironmentJAVA_HOME/usr/local/java/jdk1.8 Userchenyanliang Groupchenyanliang ExecStart/home/chenyanliang/dft/TongWeb8.0.9.12/bin/startd.sh ExecStop/home/chenyanliang/dft/TongWeb8.0.9.12/bin/stopserver.sh TimeoutStartSec120 TimeoutStopSec60 PrivateTmpfalse Restarton-failure RestartSec10 StandardOutputjournalconsole StandardErrorjournalconsole [Install] WantedBymulti-user.target注意修改以下配置TongWeb 安装路径/home/chenyanliang/dft/TongWeb8.0.9.12需要替换成实际 TongWeb 安装目录。例如WorkingDirectory/你的TongWeb目录/bin ExecStart/你的TongWeb目录/bin/startd.sh ExecStop/你的TongWeb目录/bin/stopserver.sh同时Userchenyanliang Groupchenyanliang修改为实际运行 TongWeb 的用户。加载配置创建完成后执行systemctl daemon-reload让 systemd 重新读取服务配置。TongWeb 启停管理启动 TongWebsystemctl start tongweb停止 TongWebsystemctl stop tongweb重启 TongWebsystemctl restart tongweb查看运行状态systemctl status tongweb设置开机自动启动如果希望服务器重启后自动启动 TongWebsystemctl enable tongweb查看是否设置成功systemctl is-enabled tongweb配置完成后TongWeb 的日常管理就可以直接通过 systemctl 完成不需要再进入 TongWeb 的 bin 目录手动执行启动脚本。这样也方便后续服务器重启、故障自动拉起等运维操作。