yearning开机启动
yearning-开机启动
在开机时启用服务:systemctl enable yearning
启动服务:systemctl start yearning
关闭服务:systemctl stop yearning
查看服务是否启动:systemctl list-unit-files|grep yearning
执行: rcconf 是否设置为开机启动!
[*] yearning 代表已经是开机启动状态!
cat /etc/init.d/yearning
#!/bin/bash
# ### BEGIN INIT INFO # Provides: Yearning # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Should-Start: $network $time # Should-Stop: $network $time # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start and stop the Yearning daemon # Description: Controls the Yearning server daemon "Yearning" ### END INIT INFO # #nohup ./Yearning -s -p 18000 > Yearning.log 2>&1 & start() { j=0 port="3306" # 检测数据库是否已经启动,否则将因数据库未链接成功导致启动不成功! while [[ `netstat -tnlp |grep $port |wc -l` -eq 0 ]] do echo "待待Mysql服务启动中,请稍等......耗时$j;" j=`expr $j + 1`; sleep 1 done cd /opt/Yearning-go ./yearning -s -p 18000 > ./yearning.log 2>&1 & echo -n "The Name Server boot success..." } stop() { PROCESS_NAME="yearning" PROCESS_PARM="18000" CUR_USER=`whoami` ps -ef | grep ${PROCESS_NAME} | grep ${CUR_USER} | grep "${PROCESS_PARM}" | grep -v grep | awk '{print $2}' | while read pid do kill -9 ${pid} 2>&1 >/dev/null echo "PROCESS:${PROCESS_NAME},Parameter:${PROCESS_PARM},PID:${pid} Successfully stopped" done } restart() { stop sleep 5 start } case "$1" in start) start ;; stop) stop ;; restart) restart ;; *) echo $"Usage: $0 {start|stop|restart}" exit 2 esac
正文到此结束
- 本文标签: 其他
- 本文链接: https://www.jimmy2k.top/article/246
- 版权声明: 本文由JimmyZ的个人博客原创发布,转载请遵循《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权