run install on 9841 to avoid port issues on 9842

This commit is contained in:
j 2015-02-27 16:13:15 +05:30
parent 8933b47a13
commit ce940bbec5
2 changed files with 7 additions and 6 deletions

View file

@ -12,7 +12,7 @@ import SocketServer
from threading import Thread from threading import Thread
PORT = 9842 PORT = 9841
static_dir = os.path.normpath(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', 'Resources', 'static')) static_dir = os.path.normpath(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', 'Resources', 'static'))
@ -112,14 +112,15 @@ class Install(Thread):
return data return data
def install_launchd(self): def install_launchd(self):
plist = os.path.expanduser('~/Library/LaunchAgents/com.openmedialibrary.loginscript.plist') name = 'com.openmedialibrary.loginscript'
plist = os.path.expanduser('~/Library/LaunchAgents/%s.plist'%name)
with open(plist, 'w') as f: with open(plist, 'w') as f:
f.write('''<?xml version="1.0" encoding="UTF-8"?> f.write('''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>Label</key> <key>Label</key>
<string>com.openmedialibrary.loginscript</string> <string>%s</string>
<key>ProgramArguments</key> <key>ProgramArguments</key>
<array> <array>
<string>%s/ctl</string> <string>%s/ctl</string>
@ -128,9 +129,9 @@ class Install(Thread):
<key>RunAtLoad</key> <key>RunAtLoad</key>
<true/> <true/>
</dict> </dict>
</plist>''' % self.target) </plist>''' % (name, self.target))
os.system('launchctl load "%s"' % plist) os.system('launchctl load "%s"' % plist)
os.system('launchctl start com.openmedialibrary.loginscript') os.system('launchctl start %s' % name)
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -7,7 +7,7 @@
<body> <body>
<script> <script>
function load() { function load() {
var base = 'http://127.0.0.1:9842'; var base = 'http://127.0.0.1:9841';
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.onload = function() { xhr.onload = function() {
document.location.href = base; document.location.href = base;