Front-end back-end integration

This commit is contained in:
root 2018-06-22 04:27:08 -04:00 committed by Hu
parent e6f6d9c2d2
commit 556bbbfb89
2 changed files with 24 additions and 3 deletions

View file

@ -1,6 +1,7 @@
import os import os
import time import time
import json import json
import argparse
from os.path import join, exists, dirname from os.path import join, exists, dirname
from upgrade import check_upgrade from upgrade import check_upgrade
@ -23,7 +24,7 @@ def watch_controller():
print 'seafile controller exited unexpectedly.' print 'seafile controller exited unexpectedly.'
sys.exit(1) sys.exit(1)
def main(): def main(args):
call('/scripts/create_data_links.sh') call('/scripts/create_data_links.sh')
check_upgrade() check_upgrade()
os.chdir(installdir) os.chdir(installdir)
@ -41,6 +42,8 @@ def main():
try: try:
call('{} start'.format(get_script('seafile.sh'))) call('{} start'.format(get_script('seafile.sh')))
call('{} start'.format(get_script('seahub.sh'))) call('{} start'.format(get_script('seahub.sh')))
if args.mode == 'backend':
call('{} start'.format(get_script('seafile-background-tasks.sh')))
finally: finally:
if exists(password_file): if exists(password_file):
os.unlink(password_file) os.unlink(password_file)
@ -53,4 +56,6 @@ def main():
sys.exit(0) sys.exit(0)
if __name__ == "__main__": if __name__ == "__main__":
main() parser = argparse.ArgumentParser(description='Seafile cluster start script')
parser.add_argument('--mode')
main(parser.parse_args())

View file

@ -1,2 +1,18 @@
#!/bin/bash #!/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