From 556bbbfb8925032dbfdd050d072ad6dda08fac94 Mon Sep 17 00:00:00 2001 From: root <517046497@qq.com> Date: Fri, 22 Jun 2018 04:27:08 -0400 Subject: [PATCH] Front-end back-end integration --- scripts/start.py | 9 +++++++-- scripts/start.sh | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/scripts/start.py b/scripts/start.py index a777db3..99b2951 100755 --- a/scripts/start.py +++ b/scripts/start.py @@ -1,6 +1,7 @@ import os import time import json +import argparse from os.path import join, exists, dirname from upgrade import check_upgrade @@ -23,7 +24,7 @@ def watch_controller(): print 'seafile controller exited unexpectedly.' sys.exit(1) -def main(): +def main(args): call('/scripts/create_data_links.sh') check_upgrade() os.chdir(installdir) @@ -41,6 +42,8 @@ def main(): try: call('{} start'.format(get_script('seafile.sh'))) call('{} start'.format(get_script('seahub.sh'))) + if args.mode == 'backend': + call('{} start'.format(get_script('seafile-background-tasks.sh'))) finally: if exists(password_file): os.unlink(password_file) @@ -53,4 +56,6 @@ def main(): sys.exit(0) if __name__ == "__main__": - main() + parser = argparse.ArgumentParser(description='Seafile cluster start script') + parser.add_argument('--mode') + main(parser.parse_args()) diff --git a/scripts/start.sh b/scripts/start.sh index 820624f..4f9b2fb 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,2 +1,18 @@ #!/bin/bash -python /scripts/start.py + +function start-front-end() { + python /scripts/start.py +} + +function start-back-end() { + python /scripts/start.py --mode backend +} + +case $1 in + "front-end" ) + start-front-end + ;; + "back-end" ) + start-back-end + ;; +esac