提交 a9c0aed8 编写于 作者: Y Yiru Wang Mac

modify uwsgi start service, remove manage.ini and selfpkg.ini config file, and...

modify uwsgi start service, remove manage.ini and selfpkg.ini config file, and change the start service method to run the uWSGI_service.sh file
上级 b07c295e
......@@ -56,9 +56,20 @@ pkgmnt希望提供软件包依赖,生命周期,补丁查询等功能。
3.3 启动系统服务
uwsgi -d --ini manage.ini
单独启动manage服务: sh /etc/pkgship/uWSGI_service.sh start manage
单独启动selfpkg服务: sh /etc/pkgship/uWSGI_service.sh start selfpkg
同时启动manage和selfpkg服务: sh /etc/pkgship/uWSGI_service.sh start
3.4 停止系统服务
停止manage服务: sh /etc/pkgship/uWSGI_service.sh stop manage
停止selfpkg服务: sh /etc/pkgship/uWSGI_service.sh stop selfpkg
同时停止manage和selfpkg服务: sh /etc/pkgship/uWSGI_service.sh stop
uwsgi -d --ini selfpkg.ini
#### 使用说明
......
[uwsgi]
; add an http router/server on the specified address
http = 127.0.0.1:8080
;load a WSGI module
module=packageship.manage
;load .wsgi file
wsgi-file=/usr/lib/python3.7/site-packages/packageship/manage.py
;set default WSGI callable name
callable=app
;Set internal buffer size
;Set the max size of a request (request-body excluded),
;this generally maps to the size of request headers.
;It is a security measure too, so adapt to your app
;needs instead of maxing it out.
buffer-size=65536
;daemonize uWSGI
daemonize = /var/log/uwsgi.log
[uwsgi]
; add an http router/server on the specified address
http = 127.0.0.1:8090
;load a WSGI module
module=packageship.selfpkg
;load .wsgi file
wsgi-file=/usr/lib/python3.7/site-packages/packageship/selfpkg.py
;set default WSGI callable name
callable=app
;Set internal buffer size
;Set the max size of a request (request-body excluded),
;this generally maps to the size of request headers.
;It is a security measure too, so adapt to your app
;needs instead of maxing it out.
buffer-size=65536
;daemonize uWSGI
daemonize = /var/log/uwsgi.log
#!/bin/bash
SYS_PATH=/etc/pkgship/
function get_config(){
cat $SYS_PATH/package.ini | grep -E ^$2 | sed s/[[:space:]]//g | awk 'BEGIN{FS="="}{print $2}' > config_file
}
function create_config_file(){
echo "config type is: $config_type"
get_config "$config_type" "daemonize"
daemonize=$(cat config_file)
get_config "$config_type" "buffer-size"
buffer_size=$(cat config_file)
wsgi_file_path=$(find /usr/lib/ -name "packageship")
if [ $config_type = "manage" -o $config_type = "all" ];then
get_config "$config_type" "write_port"
write_port=$(cat config_file)
get_config "$config_type" "write_ip_addr"
write_ip_addr=$(cat config_file)
echo "manage.ini:"
echo "[uwsgi]
http=$write_ip_addr:$write_port
module=packageship.manage
wsgi-file=$wsgi_file_path/manage.py
callable=app
buffer-size=$buffer_size
daemonize=$daemonize" > manage.ini
cat manage.ini
fi
if [ $config_type = "selfpkg" -o $config_type = "all" ];then
get_config "$config_type" "query_port"
query_port=$(cat config_file)
get_config "$config_type" "query_ip_addr"
query_ip_addr=$(cat config_file)
echo "selfpkg.ini:"
echo "[uwsgi]
http=$query_ip_addr:$query_port
module=packageship.selfpkg
wsgi-file=$wsgi_file_path/selfpkg.py
callable=app
buffer-size=$buffer_size
daemonize=$daemonize" > selfpkg.ini
cat selfpkg.ini
fi
}
if [ ! -n "$1" ]
then
echo "Usages: sh packageship.sh [start|stop|restart]"
exit 0
fi
if [ X$2 = X ];then
config_type="all"
elif [ $2 = "manage" -o $2 = "selfpkg" ];then
config_type=$2
else
echo "can not phase the input of $2"
exit 0
fi
create_config_file $config_type
if [ $1 = start ]
then
psid=`ps aux | grep "uwsgi" | grep -v "grep" | wc -l`
if [ $psid -gt 4 ]
then
echo "uwsgi is running!"
exit 0
else
uwsgi -d --ini /etc/pkgship/manage.ini
uwsgi -d --ini /etc/pkgship/selfpkg.ini
echo "Start uwsgi service [OK]"
fi
elif [ $1 = stop ];then
killall -9 uwsgi
echo "Stop uwsgi service [OK]"
elif [ $1 = restart ];then
killall -9 uwsgi
uwsgi -d --ini /etc/pkgship/manage.ini
uwsgi -d --ini /etc/pkgship/selfpkg.ini
echo "Restart uwsgi service [OK]"
else
echo "Usages: sh packageship.sh [start|stop|restart]"
fi
......@@ -63,7 +63,6 @@ setup(
author='gongzt',
data_files=[
(configpath, ['packageship/package.ini',
'packageship/manage.ini',
'packageship/selfpkg.ini',
'packageship/uWSGI_service.sh',
'packageship/packageship.sh'])]
)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册