Repository navigation
Expand file tree
/
Copy pathrun.py
More file actions
75 lines (59 loc) · 1.58 KB
/
Copy pathrun.py
File metadata and controls
75 lines (59 loc) · 1.58 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# -*- coding: utf-8 -*-
import os
import sys
import syslog
import getopt
from cloudplatform.install import install
debug = True
release = False
def test_meta():
from cloudplatform.meta.meta import Meta
try:
pid = os.fork()
if pid:
print "start", pid
syslog.syslog(syslog.LOG_INFO, "Cloud Platform starting with pid " + str(pid))
exit(0)
else:
with open('/dev/null', "r") as read_null, open('/dev/null', 'w') as write_null:
os.dup2(read_null.fileno(), sys.stdin.fileno())
os.dup2(write_null.fileno(), sys.stdout.fileno())
os.dup2(write_null.fileno(), sys.stderr.fileno())
local = Meta()
local.run()
except OSError:
syslog.syslog(syslog.LOG_ERR, OSError.message)
exit(1)
def test_host():
from cloudplatform.host.host import Host
try:
pid = os.fork()
if pid:
exit(0)
else:
test = Host(port=23335, broad_port=23334)
test.run()
except OSError:
exit(1)
def test1():
from cloudplatform.host import Host
host = Host(port=23335, broad_port=23334, debug=debug)
host.start()
raw_input()
host.stop()
def test2():
from cloudplatform.meta.meta import Meta
meta = Meta()
meta.run()
raw_input()
meta.stop()
if __name__ == "__main__":
# arg = sys.argv[1]
arg = "install"
if arg == "host":
test1()
if arg == "meta":
test2()
if arg == "install":
print os.getcwd()
install()