diff options
author | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-02-27 23:47:07 (GMT) |
---|---|---|
committer | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-02-27 23:47:07 (GMT) |
commit | dff5cda971bd6dca1e499349903c942d2ce0c221 (patch) | |
tree | 54e8fea0ffc1fc7c82d171402dd1ffcfebcc392a /abs/mv-core/local-website/contents | |
parent | 05a91fff085a94534d9096986d058a0b52af0849 (diff) | |
parent | 2702cde8aa327363a6a24caf55e3f041d6a2232e (diff) | |
download | linhes_pkgbuild-dff5cda971bd6dca1e499349903c942d2ce0c221.zip linhes_pkgbuild-dff5cda971bd6dca1e499349903c942d2ce0c221.tar.gz linhes_pkgbuild-dff5cda971bd6dca1e499349903c942d2ce0c221.tar.bz2 |
Merge branch 'HEAD' of ssh://cesman@knoppmyth.net/mount/repository/LinHES-PKGBUILD
Diffstat (limited to 'abs/mv-core/local-website/contents')
-rwxr-xr-x | abs/mv-core/local-website/contents/process.py | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/abs/mv-core/local-website/contents/process.py b/abs/mv-core/local-website/contents/process.py index eb70caa..99404a4 100755 --- a/abs/mv-core/local-website/contents/process.py +++ b/abs/mv-core/local-website/contents/process.py @@ -40,32 +40,22 @@ def getform(theform, valuelist, notpresent='', nolist=False): """ data = {} for field in valuelist: - - if not theform.has_key(field): # if the field is not present (or was empty) data[field] = notpresent - else: # the field is present - - - print type(theform[field]) - + print type(theform[field]) if type(theform[field]) != type([]): # is it a list or a single item - print type(theform[field]) + print type(theform[field]) data[field] = theform[field].value - else: - if not nolist: # do we want a list ? data[field] = theform.getlist(field) - else: data[field] = theform.getfirst(field) - # just fetch the first item return data @@ -119,12 +109,8 @@ def go_backup(myhost): cmd=' "sudo /etc/cron.daily/backup_cron ; sudo su nobody -c /data/srv/hobbit/server/ext/hbnotes.py"' command=sshcmd + cmd + " 2>&1 " results=os.popen(command,'r') - #print command - - return results - def go_restore(restorefile,myhost): myhostname = socket.gethostname() if myhostname.strip() == myhost.strip(): @@ -171,7 +157,7 @@ def go_updateall(allupdate_type): cmd+=allupdate_type command= cmd + " 2>&1 " results=os.popen(command,'r') - return results + return results def go_shutdown(myhost): @@ -216,16 +202,15 @@ def go_shutdownall(): def go_reboot(myhost): myhostname = socket.gethostname() if myhostname.strip() == myhost.strip(): - message="Reboot from MBE:::ALT" - os.system("/usr/bin/osdClient.pl " + myhost.strip() + " 5000 " + "\"" + message + "\"" ) - time.sleep(3) + message="Reboot from MBE:::ALT" + os.system("/usr/bin/osdClient.pl " + myhost.strip() + " 5000 " + "\"" + message + "\"" ) + time.sleep(3) command="sudo /sbin/reboot " else: command="sudo /usr/bin/func \"" + myhost.strip() + "*\ call power reboot " - message="Reboot from MBE:::ALT" - os.system("/usr/bin/osdClient.pl " + myhost.strip() + " 5000 " + "\"" + message + "\"" ) - time.sleep(3) - + message="Reboot from MBE:::ALT" + os.system("/usr/bin/osdClient.pl " + myhost.strip() + " 5000 " + "\"" + message + "\"" ) + time.sleep(3) results=os.popen(command,'r') return results @@ -234,6 +219,21 @@ def go_wake(myhost): results=os.popen(command,'r') return results +def go_kill(myhost,kill_type): + myhostname = socket.gethostname() + if myhostname.strip() == myhost.strip(): + if kill_type == "killX": + command="sudo /sbin/sv restart frontend" + else: + command="sudo /usr/bin/killall -9 mythfrontend" + else: + cmd=" call fe_restart " + cmd+=kill_type + command="sudo /usr/bin/func \"" + myhost.strip() + "*\" " + cmd + #print command + results=os.popen(command,'r') + return results + mainpage = ''' <html><head> @@ -249,7 +249,7 @@ error = ''' result = ''' <h1>%s of %s</h1> ''' -possible_parameters = ['param1', 'param2', 'param3', 'param4','hiddenparam','param5'] +possible_parameters = ['param1', 'param2', 'param3', 'param4','hiddenparam','param5','param6'] if __name__ == '__main__': cgiprint(contentheader) # content header @@ -270,7 +270,8 @@ if __name__ == '__main__': update_type = formdict['param3'] oldurl = formdict['param4'] hidden = formdict['hiddenparam'] - all_update_type=formdict['param5'] + all_update_type=formdict['param5'] + kill_type = formdict['param6'] body = result % (radio, hidden) @@ -298,6 +299,8 @@ if __name__ == '__main__': mylogfile=go_updateall(all_update_type) elif selection == "ShutdownAll": mylogfile=go_shutdownall() + elif selection == "Kill": + mylogfile=go_kill(myhost,kill_type) box=''' <div style="border: 1px solid #aaa; width:600px; height:500px; overflow:auto; color:#FFF;text-align:left;"> |