Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 39561
1
#!/usr/bin/env python
2
3
import os, sys
4
5
if not 'SMC' in os.environ:
6
os.environ['SMC'] = os.path.join(os.environ['HOME'], '.smc')
7
SMC = os.environ['SMC']
8
9
def cmd(s):
10
print s
11
if os.system(s):
12
sys.exit(1)
13
14
def remove_port_files():
15
print("Remove port files.")
16
for x in os.listdir(SMC):
17
p = os.path.join(SMC, x)
18
if os.path.isdir(p):
19
for y in os.listdir(p):
20
if y.endswith('.port'):
21
os.unlink(os.path.join(p, y))
22
23
def stop_daemons():
24
print("stop daemons")
25
cmd("smc-local-hub stop")
26
cmd("smc-console-server stop")
27
cmd("smc-sage-server stop")
28
29
30
def main():
31
remove_port_files()
32
stop_daemons()
33
34
35
if __name__ == "__main__":
36
main()
37