在目录/etc/systemd/system/下新建文件lstc_server.service,以下是文件样例。
cd /etc/systemd/system/
vi lstc_server.service
##--------------------------------------------------------------------------##
# more lstc_server.service
[Unit]
Description=LSTC Network License Manager
After=network.target
After=syslog.target
[Service]
Type=simple
WorkingDirectory=/data4/prg/lstc/
ExecStart=/data4/prg/lstc/server_start
ExecStop=/usr/bin/killall -9 lstc_server
ExecRestart=/usr/bin/killall -9 lstc_server : /data4/prg/lstc/server_start
TimeoutSec=600
Restart=on-failure
PrivateTmp=false
[Install]
WantedBy=multi-user.target
Alias=lstc_server.target
##--------------------------------------------------------------------------##
保存后
chmod -R 644 /etc/systemd/system/lstc_server.service #
systemctl daemon-reload #更新systemd配置文件
systemctl start lstc_server.service #启动服务
systemctl stop lstc_server.service #停止服务
systemctl restart lstc_server.service #重新启动服务
systemctl enable lstc_server.service #启用服务开机自启
systemctl disable lstc_server.service #禁用服务开机自启
systemctl status lstc_server.service #查看服务状态
journalctl –unit lstc_server.service #查看程序日志。
加载到系统启动服务里:
重载系统服务:systemctl daemon-reload
设置开机启动:systemctl enable *.service
启动服务:systemctl start *.service
停止服务:systemctl stop *.service
重启服务:systemctl restart *.service
为客户WorkingDirectory 和 ExecStart 里面的路径即可
/data4/prg/lstc/lstc_server -n -l /data4/prg/lstc/logfile.txt
lstc_qrun -q #查看license安装配置信息
lstc_qrun -r #查看license数量和使用状态