check daemon is running (#2734)

Co-authored-by: 杨赫然 <heran.yang@seafile.com>
This commit is contained in:
feiniks 2024-01-20 15:01:05 +08:00 committed by GitHub
parent 9ec8f933c8
commit b3c3566b41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -128,6 +128,14 @@ def _check_seafile():
print("%s not found in PATH. Have you installed seafile?" % prog)
sys.exit(1)
def _check_daemon_running():
try:
subprocess.check_output(['ps', '-C', 'seaf-daemon'])
print("seaf-daemon is already running")
sys.exit(1)
except subprocess.CalledProcessError:
return
def get_rpc_client(confdir):
return seafile.RpcClient(join(seafile_datadir, 'seafile.sock'))
@ -351,6 +359,8 @@ def seaf_start_seafile(args):
conf_dir = _conf_dir(args)
_check_daemon_running()
print("Starting seafile daemon ...")
cmd = [ "seaf-daemon", "--daemon", "-c", conf_dir, "-d", seafile_datadir,