和别人共用一台服务器搭建各自的Seafile网盘时出现这样的状况:
分别配置不同的端口号给两组seafile和seahub,
但想运行第二个seahub实例的时候总会误报seahub is already running.
于是查阅seahub.sh
中的相关函数validate_seahub_running()
发现问题出在第二个判断逻辑太松上面:
elif pgrep -f "seahub.wsgi:application" 2>/dev/null 1>&2; then echo "Seahub is already running." exit 1;
匹配了在另一路径运行的seahub
python2.7 /OTHER_DIR/seafile-server-6.3.3/seahub/thirdpart/gunicorn seahub.wsgi:application -c /OTHER_DIR/conf/gunicorn.conf --preload
实际上在匹配条件加上脚本最初声明的$gunicorn_exe
就能防止此问题了
elif pgrep -f "${gunicorn_exe} seahub.wsgi:application" 2>/dev/null 1>&2; then echo "Seahub is already running." exit 1;
同时还有后面的start_seahub()
也做相同处理
if ! pgrep -f "${gunicorn_exe} seahub.wsgi:application" 2>/dev/null 1>&2; then printf "\033[33mError:Seahub failed to start.\033[m\n" echo "Please try to run \"./seahub.sh start\" again" exit 1; fi
希望考虑一下merge这个修改