Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write PID to pidfile in runtime directory #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions scripts/seafile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ TOPDIR=$(dirname "${INSTALLPATH}")
default_ccnet_conf_dir=${TOPDIR}/ccnet
central_config_dir=${TOPDIR}/conf
seaf_controller="${INSTALLPATH}/seafile/bin/seafile-controller"

pidfile=${INSTALLPATH}/runtime/seafile.pid

export PATH=${INSTALLPATH}/seafile/bin:$PATH
export ORIG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
Expand Down Expand Up @@ -136,11 +136,13 @@ function start_seafile_server () {
sleep 3

# check if seafile server started successfully
if ! pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then
if ! pid=$(pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null); then
echo "Failed to start seafile server"
exit 1;
fi

echo ${pid} > ${pidfile}

echo "Seafile server started"
echo
}
Expand All @@ -158,6 +160,11 @@ function stop_seafile_server () {
pkill -f "fileserver -c ${default_ccnet_conf_dir}"
pkill -f "soffice.*--invisible --nocrashreport"
pkill -f "wsgidav.server.run_server"

if [[ -f ${pidfile} ]]; then
rm -f ${pidfile}
fi;

return 0
}

Expand Down