服务无法启动,log提示seatable.sh: line 89: 80 Killed
看seatable.sh是
#!/bin/bash
function stop_server() {
pkill -9 -f seaf-server
pkill -9 -f gunicorn
pkill -9 -f main.py
pkill -9 -f dist/src/index.js
pkill -9 -f dtable-db
pkill -9 -f dtable-storage-server
pkill -9 -f monitor.sh
rm -f /opt/seatable/pids/*.pid
}
function set_env() {
export SRC_DIR=/opt/seatable/seatable-server-latest
export LD_LIBRARY_PATH=/opt/seatable/seatable-server-latest/seafile/lib/:/usr/lib/x86_64-linux-gnu/nss
export PYTHONPATH=/opt/seatable/seatable-server-latest/dtable-web/thirdpart:/opt/seatable/seatable-server-latest/seafile/lib/python3/site-packages:/opt/seatable/seatable-server-latest/dtable-events
export PATH=/opt/seatable/seatable-server-latest/seafile/bin/:/opt/seatable/seatable-server-latest/dtable-web/thirdpart/bin:$PATH
export CCNET_CONF_DIR=/opt/seatable/ccnet
export SEAFILE_CONF_DIR=/opt/seatable/seafile-data
export SEAFILE_CENTRAL_CONF_DIR=/opt/seatable/conf
export DTABLE_SERVER_CONFIG=/opt/seatable/conf/dtable_server_config.json
export SEAHUB_LOG_DIR=/opt/seatable/logs
export LOG_DIR=/opt/seatable/logs
export DTABLE_WEB_DIR=/opt/seatable/seatable-server-latest/dtable-web
}
function run_python_wth_env() {
set_env
python3 ${*:2}
}
function create_superuser() {
set_env
cd /opt/seatable/seatable-server-latest/dtable-web
python3 manage.py createsuperuser
}
function check_folder() {
if [[ ! -e /opt/seatable/conf ]]; then
echo 'do not find /opt/seatable/conf path'
exit 1
fi
}
function init_plugins_repo() {
if grep -q -F "PLUGINS_REPO_ID" /opt/seatable/conf/dtable_web_settings.py; then
return 0
else
repo_id=$(python -c "from seaserv import seafile_api; repo_id = seafile_api.create_repo('plugins repo', 'plugins repo', 'dtable@seafile'); print(repo_id)")
echo -e "\nPLUGINS_REPO_ID='"${repo_id}"'" >>/opt/seatable/conf/dtable_web_settings.py
fi
}
function init_gunicorn() {
if [[ ! -f /opt/seatable/conf/gunicorn.py ]]; then
init
fi
}
function start_server() {
check_folder
init_gunicorn
stop_server
sleep 0.5
set_env
seaf-server -F /opt/seatable/conf -c /opt/seatable/ccnet -d /opt/seatable/seafile-data -l /opt/seatable/logs/seafile.log -P /opt/seatable/pids/seafile.pid - &
sleep 1
init_plugins_repo
cd /opt/seatable/seatable-server-latest/dtable-events/dtable_events
python main.py --config-file /opt/seatable/conf/dtable-events.conf --logfile /opt/seatable/logs/dtable-events.log &>>/opt/seatable/logs/dtable-events.log &
sleep 1
cd /opt/seatable/seatable-server-latest/dtable-web
gunicorn seahub.wsgi:application -c /opt/seatable/conf/gunicorn.py &
sleep 0.2
cd /opt/seatable/seatable-server-latest/dtable-server
node dist/src/index.js &>>/opt/seatable/logs/dtable-server.log &
sleep 0.2
cd /opt/seatable/seatable-server-latest/dtable-db
./dtable-db -c /opt/seatable/conf/dtable-db.conf & echo $! > /opt/seatable/pids/dtable-db.pid
sleep 0.2
cd /opt/seatable/seatable-server-latest/dtable-storage-server
./dtable-storage-server -c /opt/seatable/conf/dtable-storage-server.conf & echo $! > /opt/seatable/pids/dtable-storage-server.pid
sleep 0.2
/templates/monitor.sh &>> /opt/seatable/logs/monitor.log &
echo "SeaTable started"
echo
}
function upgrade_sql() {
mysql -h $DB_HOST -p$DB_ROOT_PASSWD dtable_db </opt/seatable/seatable-server-latest/sql/mysql/upgrade/${*:2}/dtable.sql
if [[ -e /opt/seatable/seatable-server-latest/sql/mysql/upgrade/${*:2}/seafile.sql ]]; then
mysql -h $DB_HOST -p$DB_ROOT_PASSWD seafile_db </opt/seatable/seatable-server-latest/sql/mysql/upgrade/${*:2}/seafile.sql
fi
if [[ -e /opt/seatable/seatable-server-latest/sql/mysql/upgrade/${*:2}/ccnet.sql ]]; then
mysql -h $DB_HOST -p$DB_ROOT_PASSWD ccnet_db </opt/seatable/seatable-server-latest/sql/mysql/upgrade/${*:2}/ccnet.sql
fi
}
function init_sql() {
set_env
python3 /templates/init_sql.py
}
function init() {
if [[ ! -e /opt/seatable/conf ]]; then
mkdir /opt/seatable/conf
fi
set_env
python3 /templates/init_config.py
}
function gc() {
set_env
/opt/seatable/seatable-server-latest/seaf-gc.sh ${*:2}
}
function backup_all() {
set_env
cd /opt/seatable/seatable-server-latest/dtable-web/
python3 manage.py backup_all_bases
}
function restore_all() {
set_env
cd /opt/seatable/seatable-server-latest/dtable-web/
python3 manage.py restore_all_bases
}
case $1 in
"start")
start_server
;;
"python-env")
run_python_wth_env "$@"
;;
"stop")
stop_server
;;
"superuser")
create_superuser
;;
"init")
init
;;
"init-sql")
init_sql
;;
"upgrade-sql")
upgrade_sql "$@"
;;
"gc")
gc "$@"
;;
"backup-all")
backup_all
;;
"restore-all")
restore_all
;;
*)
start_server
;;
esac