-
Notifications
You must be signed in to change notification settings - Fork 0
/
omero-web
executable file
·39 lines (32 loc) · 989 Bytes
/
omero-web
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
import os
import subprocess
import sys
def run(*args, **kwargs):
return subprocess.run(*args, **kwargs)
omerodir = os.getenv('OMERODIR')
if not omerodir:
omerodir = os.path.join(
os.environ['CONDA_PREFIX'], 'opt/omero/web/OMERO.web')
os.environ['OMERODIR'] = omerodir
configdir = os.path.join(os.path.dirname(omerodir), 'config')
web_commands = (
'start',
'stop',
'restart',
'status',
)
args = sys.argv[1:]
if args and args[0] in web_commands:
if args[0] == 'start':
if os.path.isdir(configdir):
p = run(['omero', 'load', '--glob',
os.path.join(configdir, '*.omero')], check=True)
p = run(['omero', 'web'] + args)
elif args and args[0] in ('help', '--help'):
print('Built in commands:\n {}'.format(web_commands))
print('All other commands are passed to omero executable\n')
p = run(['omero', '--help'])
else:
p = run(['omero'] + args)
sys.exit(p.returncode)