mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-19 18:29:23 +00:00
Remove seaf controller (#7013)
* remove seafile-controller * set_file_config
This commit is contained in:
@@ -47,13 +47,13 @@ function check_component_running() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function validate_already_running () {
|
function validate_already_running () {
|
||||||
if pid=$(pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null); then
|
if pid=$(pgrep -f "seafile-monitor.sh" 2>/dev/null); then
|
||||||
echo "seafile server is still running, stop it by \"seafile.sh stop\""
|
echo "seafile server is still running, stop it by \"seafile.sh stop\""
|
||||||
echo
|
echo
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_component_running "seaf-server" "seaf-server -c ${default_ccnet_conf_dir}"
|
check_component_running "seaf-server" "seaf-server"
|
||||||
check_component_running "seafdav" "wsgidav.server.server_cli"
|
check_component_running "seafdav" "wsgidav.server.server_cli"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -46,7 +46,7 @@ function validate_seafile_data_dir () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function validate_already_running () {
|
function validate_already_running () {
|
||||||
if pid=$(pgrep -f "seaf-fuse -c ${default_ccnet_conf_dir}" 2>/dev/null); then
|
if pid=$(pgrep -f "seaf-fuse" 2>/dev/null); then
|
||||||
echo "seaf-fuse is already running, pid $pid"
|
echo "seaf-fuse is already running, pid $pid"
|
||||||
echo
|
echo
|
||||||
exit 1;
|
exit 1;
|
||||||
@@ -54,9 +54,9 @@ function validate_already_running () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function warning_if_seafile_not_running () {
|
function warning_if_seafile_not_running () {
|
||||||
if ! pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then
|
if ! pgrep -f "seafile-monitor.sh" 2>/dev/null 1>&2; then
|
||||||
echo
|
echo
|
||||||
echo "Warning: seafile-controller not running. Have you run \"./seafile.sh start\" ?"
|
echo "Warning: seafile server not running. Have you run \"./seafile.sh start\" ?"
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ function start_seaf_fuse () {
|
|||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# check if seaf-fuse started successfully
|
# check if seaf-fuse started successfully
|
||||||
if ! pgrep -f "seaf-fuse -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then
|
if ! pgrep -f "seaf-fuse" 2>/dev/null 1>&2; then
|
||||||
echo "Failed to start seaf-fuse"
|
echo "Failed to start seaf-fuse"
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
@@ -90,13 +90,13 @@ function start_seaf_fuse () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function stop_seaf_fuse() {
|
function stop_seaf_fuse() {
|
||||||
if ! pgrep -f "seaf-fuse -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then
|
if ! pgrep -f "seaf-fuse" 2>/dev/null 1>&2; then
|
||||||
echo "seaf-fuse not running yet"
|
echo "seaf-fuse not running yet"
|
||||||
return 1;
|
return 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Stopping seaf-fuse ..."
|
echo "Stopping seaf-fuse ..."
|
||||||
pkill -SIGTERM -f "seaf-fuse -c ${default_ccnet_conf_dir}"
|
pkill -SIGTERM -f "seaf-fuse"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -77,14 +77,14 @@ function check_component_running() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function validate_already_running () {
|
function validate_already_running () {
|
||||||
if pid=$(pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null); then
|
if pid=$(pgrep -f "seafile-monitor.sh" 2>/dev/null); then
|
||||||
echo "seafile server is still running, stop it by \"seafile.sh stop\""
|
echo "seafile server is still running, stop it by \"seafile.sh stop\""
|
||||||
echo
|
echo
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_component_running "seaf-server" "seaf-server -c ${default_ccnet_conf_dir}"
|
check_component_running "seaf-server" "seaf-server"
|
||||||
check_component_running "fileserver" "fileserver -c ${default_ccnet_conf_dir}"
|
check_component_running "fileserver" "fileserver"
|
||||||
check_component_running "seafdav" "wsgidav.server.server_cli"
|
check_component_running "seafdav" "wsgidav.server.server_cli"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,13 +50,13 @@ function check_component_running() {
|
|||||||
|
|
||||||
<<'COMMENT'
|
<<'COMMENT'
|
||||||
function validate_already_running () {
|
function validate_already_running () {
|
||||||
if pid=$(pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null); then
|
if pid=$(pgrep -f "seafile-monitor.sh" 2>/dev/null); then
|
||||||
echo "seafile server is still running, stop it by \"seafile.sh stop\""
|
echo "seafile server is still running, stop it by \"seafile.sh stop\""
|
||||||
echo
|
echo
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_component_running "seaf-server" "seaf-server -c ${default_ccnet_conf_dir}"
|
check_component_running "seaf-server" "seaf-server"
|
||||||
check_component_running "seafdav" "wsgidav.server.server_cli"
|
check_component_running "seafdav" "wsgidav.server.server_cli"
|
||||||
}
|
}
|
||||||
COMMENT
|
COMMENT
|
||||||
|
@@ -80,9 +80,9 @@ function ensure_single_instance () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function warning_if_seafile_not_running () {
|
function warning_if_seafile_not_running () {
|
||||||
if ! pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then
|
if ! pgrep -f "seafile-monitor.sh" 2>/dev/null 1>&2; then
|
||||||
echo
|
echo
|
||||||
echo "Warning: seafile-controller not running. Have you run \"./seafile.sh start\" ?"
|
echo "Warning: seafile server not running. Have you run \"./seafile.sh start\" ?"
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,6 @@ TOPDIR=$(dirname "${INSTALLPATH}")
|
|||||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||||
central_config_dir=${TOPDIR}/conf
|
central_config_dir=${TOPDIR}/conf
|
||||||
seaf_controller="${INSTALLPATH}/seafile/bin/seafile-controller"
|
|
||||||
pro_pylibs_dir=${INSTALLPATH}/pro/python
|
pro_pylibs_dir=${INSTALLPATH}/pro/python
|
||||||
seafesdir=$pro_pylibs_dir/seafes
|
seafesdir=$pro_pylibs_dir/seafes
|
||||||
seahubdir=${INSTALLPATH}/seahub
|
seahubdir=${INSTALLPATH}/seahub
|
||||||
@@ -55,9 +54,18 @@ function check_python_executable() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_jwt_private_key () {
|
function set_file_config () {
|
||||||
|
if [ -z "${ENABLE_FILESERVER}" ]; then
|
||||||
|
export ENABLE_FILESERVER=`awk -F '=' '/\[fileserver\]/{a=1}a==1&&$1~/^use_go_fileserver/{print $2;exit}' ${SEAFILE_CENTRAL_CONF_DIR}/seafile.conf`
|
||||||
|
fi
|
||||||
|
if [ -z "${ENABLE_SEAFDAV}" ]; then
|
||||||
|
export ENABLE_SEAFDAV=`awk -F '=' '/\[WEBDAV\]/{a=1}a==1&&$1~/^enabled/{print $2;exit}' ${SEAFILE_CENTRAL_CONF_DIR}/seafdav.conf`
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_env_config () {
|
||||||
if [ -z "${JWT_PRIVATE_KEY}" ]; then
|
if [ -z "${JWT_PRIVATE_KEY}" ]; then
|
||||||
if [ ! -e "${central_config_dir}/.env" ]; then
|
if [ ! -e "${SEAFILE_CENTRAL_CONF_DIR}/.env" ]; then
|
||||||
echo "Error: .env file not found."
|
echo "Error: .env file not found."
|
||||||
echo "Please follow the upgrade manual to set the .env file."
|
echo "Please follow the upgrade manual to set the .env file."
|
||||||
echo ""
|
echo ""
|
||||||
@@ -65,7 +73,7 @@ function set_jwt_private_key () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# load the .env file
|
# load the .env file
|
||||||
source "${central_config_dir}/.env"
|
source "${SEAFILE_CENTRAL_CONF_DIR}/.env"
|
||||||
|
|
||||||
if [ -z "${JWT_PRIVATE_KEY}" ]; then
|
if [ -z "${JWT_PRIVATE_KEY}" ]; then
|
||||||
echo "Error: JWT_PRIVATE_KEY not found in .env file."
|
echo "Error: JWT_PRIVATE_KEY not found in .env file."
|
||||||
@@ -74,6 +82,11 @@ function set_jwt_private_key () {
|
|||||||
exit -1;
|
exit -1;
|
||||||
fi
|
fi
|
||||||
export JWT_PRIVATE_KEY=${JWT_PRIVATE_KEY}
|
export JWT_PRIVATE_KEY=${JWT_PRIVATE_KEY}
|
||||||
|
export SEAFILE_SERVER_PROTOCOL=${SEAFILE_SERVER_PROTOCOL}
|
||||||
|
export SEAFILE_SERVER_HOSTNAME=${SEAFILE_SERVER_HOSTNAME}
|
||||||
|
export SITE_ROOT=${SITE_ROOT}
|
||||||
|
export ENABLE_FILESERVER=${ENABLE_FILESERVER}
|
||||||
|
export ENABLE_SEAFDAV=${ENABLE_SEAFDAV}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,13 +109,78 @@ function check_process() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# start
|
# start
|
||||||
|
function start_seaf_server() {
|
||||||
|
LD_LIBRARY_PATH=${SEAFILE_LD_LIBRARY_PATH} ${INSTALLPATH}/seafile/bin/seaf-server \
|
||||||
|
-F ${SEAFILE_CENTRAL_CONF_DIR} \
|
||||||
|
-c ${CCNET_CONF_DIR} \
|
||||||
|
-d ${SEAFILE_CONF_DIR} \
|
||||||
|
-l ${TOPDIR}/logs/seafile.log \
|
||||||
|
-P ${TOPDIR}/pids/seaf-server.pid \
|
||||||
|
-p ${SEAFILE_RPC_PIPE_PATH} \
|
||||||
|
-f -L ${TOPDIR} &
|
||||||
|
sleep 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function start_fileserver() {
|
||||||
|
${INSTALLPATH}/seafile/bin/fileserver \
|
||||||
|
-F ${SEAFILE_CENTRAL_CONF_DIR} \
|
||||||
|
-d ${SEAFILE_CONF_DIR} \
|
||||||
|
-l ${TOPDIR}/logs/fileserver.log \
|
||||||
|
-p ${SEAFILE_RPC_PIPE_PATH} \
|
||||||
|
-P ${TOPDIR}/pids/fileserver.pid &
|
||||||
|
sleep 1
|
||||||
|
}
|
||||||
|
|
||||||
function start_seafevents() {
|
function start_seafevents() {
|
||||||
check_python_executable;
|
check_python_executable;
|
||||||
$PYTHON -m seafevents.main --config-file ${central_config_dir}/seafevents.conf --logfile ${TOPDIR}/logs/seafevents.log -P ${TOPDIR}/pids/seafevents.pid &
|
$PYTHON -m seafevents.main \
|
||||||
|
--config-file ${SEAFILE_CENTRAL_CONF_DIR}/seafevents.conf \
|
||||||
|
--logfile ${TOPDIR}/logs/seafevents.log \
|
||||||
|
-P ${TOPDIR}/pids/seafevents.pid &
|
||||||
|
sleep 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function start_seafdav() {
|
||||||
|
check_python_executable;
|
||||||
|
SEAFDAV_HOST="0.0.0.0"
|
||||||
|
SEAFDAV_PORT=8080
|
||||||
|
seafdav_host=`awk -F '=' '/\[WEBDAV\]/{a=1}a==1&&$1~/^host/{print $2;exit}' ${SEAFILE_CENTRAL_CONF_DIR}/seafdav.conf`
|
||||||
|
seafdav_port=`awk -F '=' '/\[WEBDAV\]/{a=1}a==1&&$1~/^port/{print $2;exit}' ${SEAFILE_CENTRAL_CONF_DIR}/seafdav.conf`
|
||||||
|
if [ $seafdav_host ]; then
|
||||||
|
SEAFDAV_HOST=$seafdav_host
|
||||||
|
fi
|
||||||
|
if [ $seafdav_port ]; then
|
||||||
|
SEAFDAV_PORT=$((seafdav_port))
|
||||||
|
fi
|
||||||
|
$PYTHON -m wsgidav.server.server_cli \
|
||||||
|
--server gunicorn \
|
||||||
|
--root / \
|
||||||
|
--log-file ${TOPDIR}/logs/seafdav.log \
|
||||||
|
--pid ${TOPDIR}/pids/seafdav.pid \
|
||||||
|
--port ${SEAFDAV_PORT} \
|
||||||
|
--host ${SEAFDAV_HOST} &
|
||||||
sleep 1
|
sleep 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# monitor
|
# monitor
|
||||||
|
function monitor_seaf_server() {
|
||||||
|
process_name="seaf-server"
|
||||||
|
check_num=$(check_process $process_name)
|
||||||
|
if [ $check_num -eq 0 ]; then
|
||||||
|
log "Start $process_name"
|
||||||
|
start_seaf_server
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function monitor_fileserver() {
|
||||||
|
process_name="fileserver"
|
||||||
|
check_num=$(check_process $process_name)
|
||||||
|
if [ $check_num -eq 0 ]; then
|
||||||
|
log "Start $process_name"
|
||||||
|
start_fileserver
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function monitor_seafevents() {
|
function monitor_seafevents() {
|
||||||
process_name="seafevents.main"
|
process_name="seafevents.main"
|
||||||
check_num=$(check_process $process_name)
|
check_num=$(check_process $process_name)
|
||||||
@@ -112,21 +190,40 @@ function monitor_seafevents() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# check enabled
|
function monitor_seafdav() {
|
||||||
ENABLE_NOTIFICATION_SERVER=`awk -F '=' '/\[notification\]/{a=1}a==1&&$1~/^enabled/{print $2;exit}' ${central_config_dir}/seafile.conf`
|
process_name="wsgidav.server.server_cli"
|
||||||
IS_PRO_SEAFEVENTS=`awk '/is_pro/{getline;print $2;exit}' ${pro_pylibs_dir}/seafevents/seafevents_api.py`
|
check_num=$(check_process $process_name)
|
||||||
|
if [ $check_num -eq 0 ]; then
|
||||||
|
log "Start $process_name"
|
||||||
|
start_seafdav
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
set_jwt_private_key;
|
|
||||||
|
# check enabled
|
||||||
|
set_file_config
|
||||||
|
|
||||||
|
set_env_config;
|
||||||
|
|
||||||
log "Start Monitor"
|
log "Start Monitor"
|
||||||
|
|
||||||
while [ 1 ]; do
|
while [ 1 ]; do
|
||||||
|
|
||||||
|
monitor_seaf_server
|
||||||
|
|
||||||
|
if [ $ENABLE_FILESERVER ]; then
|
||||||
|
monitor_fileserver
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $CLUSTER_MODE ] && [ $CLUSTER_MODE = "backend" ]; then
|
if [ $CLUSTER_MODE ] && [ $CLUSTER_MODE = "backend" ]; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
monitor_seafevents
|
monitor_seafevents
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $ENABLE_SEAFDAV ]; then
|
||||||
|
monitor_seafdav
|
||||||
|
fi
|
||||||
|
|
||||||
sleep 30
|
sleep 30
|
||||||
done
|
done
|
||||||
|
@@ -18,14 +18,17 @@ TOPDIR=$(dirname "${INSTALLPATH}")
|
|||||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||||
central_config_dir=${TOPDIR}/conf
|
central_config_dir=${TOPDIR}/conf
|
||||||
seaf_controller="${INSTALLPATH}/seafile/bin/seafile-controller"
|
|
||||||
pro_pylibs_dir=${INSTALLPATH}/pro/python
|
pro_pylibs_dir=${INSTALLPATH}/pro/python
|
||||||
seafesdir=$pro_pylibs_dir/seafes
|
seafesdir=$pro_pylibs_dir/seafes
|
||||||
IS_PRO_SEAFEVENTS=`awk '/is_pro/{getline;print $2;exit}' ${pro_pylibs_dir}/seafevents/seafevents_api.py`
|
seafile_rpc_pipe_path=${INSTALLPATH}/runtime
|
||||||
|
|
||||||
export PATH=${INSTALLPATH}/seafile/bin:$PATH
|
export PATH=${INSTALLPATH}/seafile/bin:$PATH
|
||||||
export ORIG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
|
export ORIG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
|
||||||
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
|
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
|
||||||
|
export SEAFILE_CENTRAL_CONF_DIR=${central_config_dir}
|
||||||
|
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||||
|
export SEAFILE_CONF_DIR=${default_seafile_data_dir}
|
||||||
|
export SEAFILE_RPC_PIPE_PATH=${seafile_rpc_pipe_path}
|
||||||
|
|
||||||
script_name=$0
|
script_name=$0
|
||||||
function usage () {
|
function usage () {
|
||||||
@@ -57,7 +60,7 @@ if [[ -d ${INSTALLPATH}/pro ]]; then
|
|||||||
export SEAFES_DIR=$seafesdir
|
export SEAFES_DIR=$seafesdir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function set_jwt_private_key () {
|
function set_env_config () {
|
||||||
if [ -z "${JWT_PRIVATE_KEY}" ]; then
|
if [ -z "${JWT_PRIVATE_KEY}" ]; then
|
||||||
if [ ! -e "${central_config_dir}/.env" ]; then
|
if [ ! -e "${central_config_dir}/.env" ]; then
|
||||||
echo "Error: .env file not found."
|
echo "Error: .env file not found."
|
||||||
@@ -76,6 +79,11 @@ function set_jwt_private_key () {
|
|||||||
exit -1;
|
exit -1;
|
||||||
fi
|
fi
|
||||||
export JWT_PRIVATE_KEY=${JWT_PRIVATE_KEY}
|
export JWT_PRIVATE_KEY=${JWT_PRIVATE_KEY}
|
||||||
|
export SEAFILE_SERVER_PROTOCOL=${SEAFILE_SERVER_PROTOCOL}
|
||||||
|
export SEAFILE_SERVER_HOSTNAME=${SEAFILE_SERVER_HOSTNAME}
|
||||||
|
export SITE_ROOT=${SITE_ROOT}
|
||||||
|
export ENABLE_FILESERVER=${ENABLE_FILESERVER}
|
||||||
|
export ENABLE_SEAFDAV=${ENABLE_SEAFDAV}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,12 +105,6 @@ function validate_seafile_data_dir () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_config() {
|
|
||||||
if ! LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_controller} -t -c "${default_ccnet_conf_dir}" -d "${default_seafile_data_dir}" -F "${central_config_dir}" ; then
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function check_component_running() {
|
function check_component_running() {
|
||||||
name=$1
|
name=$1
|
||||||
cmd=$2
|
cmd=$2
|
||||||
@@ -118,81 +120,73 @@ function check_component_running() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function validate_already_running () {
|
function validate_already_running () {
|
||||||
if pid=$(pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null); then
|
if pid=$(pgrep -f "seafile-monitor.sh" 2>/dev/null); then
|
||||||
echo "Seafile controller is already running, pid $pid"
|
echo "Seafile monitor is already running, pid $pid"
|
||||||
echo
|
echo
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_component_running "seaf-server" "seaf-server -c ${default_ccnet_conf_dir}"
|
check_component_running "seaf-server" "seaf-server"
|
||||||
check_component_running "fileserver" "fileserver -c ${default_ccnet_conf_dir}"
|
check_component_running "fileserver" "fileserver"
|
||||||
check_component_running "seafdav" "wsgidav.server.server_cli"
|
check_component_running "seafdav" "wsgidav.server.server_cli"
|
||||||
check_component_running "seafevents" "seafevents.main --config-file ${central_config_dir}"
|
check_component_running "seafevents" "seafevents.main --config-file ${central_config_dir}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_seafile_server () {
|
function start_seafile_server () {
|
||||||
set_jwt_private_key;
|
set_env_config;
|
||||||
validate_already_running;
|
validate_already_running;
|
||||||
validate_central_conf_dir;
|
validate_central_conf_dir;
|
||||||
validate_seafile_data_dir;
|
validate_seafile_data_dir;
|
||||||
validate_running_user;
|
validate_running_user;
|
||||||
|
|
||||||
if [[ $IS_PRO_SEAFEVENTS = "True" ]]; then
|
|
||||||
test_config;
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Starting seafile server, please wait ..."
|
echo "Starting seafile server, please wait ..."
|
||||||
|
|
||||||
mkdir -p $TOPDIR/logs
|
mkdir -p $TOPDIR/logs
|
||||||
|
|
||||||
if [[ $IS_PRO_SEAFEVENTS = "True" ]]; then
|
# seaf-server
|
||||||
if ! LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_controller} -c "${default_ccnet_conf_dir}" -d "${default_seafile_data_dir}" -F "${central_config_dir}"; then
|
LD_LIBRARY_PATH=${SEAFILE_LD_LIBRARY_PATH} ${INSTALLPATH}/seafile/bin/seaf-server \
|
||||||
controller_log="$default_seafile_data_dir/controller.log"
|
-F ${SEAFILE_CENTRAL_CONF_DIR} \
|
||||||
echo
|
-c ${CCNET_CONF_DIR} \
|
||||||
echo "Failed to start seafile server. See $controller_log for more details."
|
-d ${SEAFILE_CONF_DIR} \
|
||||||
echo
|
-l ${TOPDIR}/logs/seafile.log \
|
||||||
exit 1
|
-P ${TOPDIR}/pids/seaf-server.pid \
|
||||||
fi
|
-p ${SEAFILE_RPC_PIPE_PATH} \
|
||||||
else
|
-f -L ${TOPDIR} &
|
||||||
LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_controller} \
|
|
||||||
-c "${default_ccnet_conf_dir}" \
|
|
||||||
-d "${default_seafile_data_dir}" \
|
|
||||||
-F "${central_config_dir}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
sleep 3
|
sleep 2
|
||||||
|
|
||||||
|
# seafile-monitor
|
||||||
|
${INSTALLPATH}/seafile-monitor.sh &>> ${TOPDIR}/logs/seafile-monitor.log &
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
# check if seafile server started successfully
|
# check if seafile server started successfully
|
||||||
if ! pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then
|
if ! pgrep -f "seaf-server" 2>/dev/null 1>&2; then
|
||||||
echo "Failed to start seafile server"
|
echo "Failed to start seafile server"
|
||||||
|
kill_all
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# seafevents, notification-sever
|
|
||||||
${INSTALLPATH}/seafile-monitor.sh &>> ${TOPDIR}/logs/seafile-monitor.log &
|
|
||||||
|
|
||||||
echo "Seafile server started"
|
echo "Seafile server started"
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
function kill_all () {
|
function kill_all () {
|
||||||
pkill -f "seaf-server -c ${default_ccnet_conf_dir}"
|
pkill -f "seaf-server"
|
||||||
pkill -f "fileserver -c ${default_ccnet_conf_dir}"
|
pkill -f "fileserver"
|
||||||
pkill -f "seafevents.main"
|
pkill -f "seafevents.main"
|
||||||
pkill -f "wsgidav.server.server_cli"
|
pkill -f "wsgidav.server.server_cli"
|
||||||
pkill -f "notification-server -c ${central_config_dir}"
|
pkill -f "seafile-monitor.sh"
|
||||||
pkill -f "seafile-monitor.sh"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function stop_seafile_server () {
|
function stop_seafile_server () {
|
||||||
if ! pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then
|
if ! pgrep -f "seafile-monitor.sh" 2>/dev/null 1>&2; then
|
||||||
echo "seafile server not running yet"
|
echo "seafile server not running yet"
|
||||||
kill_all
|
kill_all
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Stopping seafile server ..."
|
echo "Stopping seafile server ..."
|
||||||
pkill -SIGTERM -f "seafile-controller -c ${default_ccnet_conf_dir}"
|
|
||||||
kill_all
|
kill_all
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
@@ -126,9 +126,9 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
function warning_if_seafile_not_running () {
|
function warning_if_seafile_not_running () {
|
||||||
if ! pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then
|
if ! pgrep -f "seafile-monitor.sh" 2>/dev/null 1>&2; then
|
||||||
echo
|
echo
|
||||||
echo "Warning: seafile-controller not running. Have you run \"./seafile.sh start\" ?"
|
echo "Warning: seafile server not running. Have you run \"./seafile.sh start\" ?"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -186,7 +186,7 @@ function start_seahub () {
|
|||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_jwt_private_key () {
|
function set_env_config () {
|
||||||
if [ -z "${JWT_PRIVATE_KEY}" ]; then
|
if [ -z "${JWT_PRIVATE_KEY}" ]; then
|
||||||
if [ ! -e "${central_config_dir}/.env" ]; then
|
if [ ! -e "${central_config_dir}/.env" ]; then
|
||||||
echo "Error: .env file not found."
|
echo "Error: .env file not found."
|
||||||
@@ -205,11 +205,16 @@ function set_jwt_private_key () {
|
|||||||
exit -1;
|
exit -1;
|
||||||
fi
|
fi
|
||||||
export JWT_PRIVATE_KEY=${JWT_PRIVATE_KEY}
|
export JWT_PRIVATE_KEY=${JWT_PRIVATE_KEY}
|
||||||
|
export SEAFILE_SERVER_PROTOCOL=${SEAFILE_SERVER_PROTOCOL}
|
||||||
|
export SEAFILE_SERVER_HOSTNAME=${SEAFILE_SERVER_HOSTNAME}
|
||||||
|
export SITE_ROOT=${SITE_ROOT}
|
||||||
|
export ENABLE_SEADOC=${ENABLE_SEADOC}
|
||||||
|
export SEADOC_SERVER_URL=${SEADOC_SERVER_URL}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepare_env() {
|
function prepare_env() {
|
||||||
set_jwt_private_key;
|
set_env_config;
|
||||||
check_python_executable;
|
check_python_executable;
|
||||||
validate_seafile_data_dir;
|
validate_seafile_data_dir;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user