代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/pkgship 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
--- a/packageship/pkgshipd
+++ b/packageship/pkgshipd
@@ -3,7 +3,7 @@ SYS_PATH=/etc/pkgship
OUT_PATH=/opt/pkgship/uwsgi
OPERATION=$1
PKGSHIP_CONSTANT="pkgship"
-MEM_THRESHOLD='700'
+MEM_THRESHOLD='2048'
MEM_FREE=$(free -m | grep "Mem" | awk '{print $7}')
function check_user() {
@@ -262,22 +262,34 @@ function uwsgi_log_logrotate() {
echo "[INFO] Start the logrotate task success"
}
+function is_started() {
+ pkgship_version=$(pkgship -v)
+ if [[ -n ${pkgship_version} ]] && [[ ${pkgship_version} =~ "Version" ]]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
function start_service() {
- uwsgi_pid=$(ps -ef | grep -v grep | grep "uwsgi" | grep "${PKGSHIP_CONSTANT}.ini" | awk '{print $2}')
- if [ -n "${uwsgi_pid}" ]; then
+ if is_started; then
echo "[ERROR] ${PKGSHIP_CONSTANT} service is running, please stop it first."
exit 1
else
uwsgi -d --ini $OUT_PATH/${PKGSHIP_CONSTANT}.ini
echo "[INFO] START uwsgi service: ${PKGSHIP_CONSTANT}.ini"
- uwsgi_pid=$(ps -ef | grep -v grep | grep "uwsgi" | grep "${PKGSHIP_CONSTANT}.ini" | awk '{print $2}')
- if [ -z "${uwsgi_pid}" ]; then
- echo "[ERROR] Service failed to start, please check log $(get_config "daemonize")"
- exit 1
- fi
- uwsgi_log_logrotate
- echo "[INFO] Start pkgship service success!!!"
- exit 0
+
+ for i in {1..5}; do
+ if is_started; then
+ uwsgi_log_logrotate
+ echo "[INFO] Start pkgship service success!!!"
+ exit 0
+ fi
+ sleep 2s
+ done
+
+ echo "[ERROR] Service failed to start, please check log $(get_config "daemonize")"
+ exit 1
fi
}
@@ -288,8 +300,7 @@ function stop_service() {
exit 1
fi
- uwsgi_pid=$(ps -ef | grep -v grep | grep "uwsgi" | grep "${PKGSHIP_CONSTANT}.ini" | awk '{print $2}')
- if [ -n "${uwsgi_pid}" ]; then
+ if is_started; then
uwsgi --stop $OUT_PATH/${PKGSHIP_CONSTANT}.pid
echo "[INFO] STOP uwsgi service: $OUT_PATH/${PKGSHIP_CONSTANT}.ini"
echo "[INFO] The run log is saved into: $(get_config "daemonize")"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。