diff options
Diffstat (limited to 'abs/core/supplemental-web')
32 files changed, 891 insertions, 231 deletions
diff --git a/abs/core/supplemental-web/PKGBUILD b/abs/core/supplemental-web/PKGBUILD index a756347..824b7bd 100644 --- a/abs/core/supplemental-web/PKGBUILD +++ b/abs/core/supplemental-web/PKGBUILD @@ -1,38 +1,82 @@ -pkgname=supplemental-web -pkgver=1.0 -pkgrel=17 -arch=('i686') -MVDIR=$startdir/pkg/usr/MythVantage -install=supplemental-web.install +pkgbase=supplemental-web +pkgname=('supplemental-web' 'supplemental-web-slave') +pkgver=8.0 +pkgrel=1 +arch=('i686' 'x86_64') + backup=('extra.cfg.txt') -source=(lighttpd-supplement.conf extra.cfg.txt wakeonlan.sh backend_control.sh) -depends=('lighttpd' 'php' 'fcgi' 'python' 'xymonserver' 'certmaster' 'func' 'python_aosd' 'LinHES-system>=2-50') +source=(lighttpd-supplement.conf extra.cfg.txt wakeonlan.sh slaveserve.py supplemental_slave.rules supplemental_web.rules ) +build(){ + cd $startdir/src +} +# +# build() { +# cd $startdir/src +# mkdir -p $MVDIR/etc +# install -m755 -D lighttpd-supplement.conf $pkgdir/etc/gen_light_conf.d/lighttpd-supplement.conf +# install -m755 -D wakeonlan.sh $MVDIR/bin/wakeonlan.sh +# # install -m755 -D backend_control.sh $MVDIR/bin/backend_control.sh +# mkdir -p $startdir/pkg/data/srv/httpd/htdocs/ +# cp -rp $startdir/contents/* $startdir/pkg/data/srv/httpd/htdocs +# chmod -R 755 $startdir/pkg/data/srv/httpd/htdocs +# cd $startdir +# mkdir -p $startdir/pkg/data/srv/httpd/ +# cp -rp cgi $startdir/pkg/data/srv/httpd/ +# cd $startdir/src +# install -m755 -D extra.cfg.txt $pkgdir/data/srv/httpd/cgi/extra.cfg.txt +# } +package_supplemental-web() { + pkgdesc="supplemental-web package for master backend" + depends=('wol' 'etherwake' 'lighttpd' 'php' 'fcgi' 'python2' 'xymonserver' 'certmaster' 'func' 'python_aosd' 'LinHES-system>=2-50') + install=supplemental-web.install + cd $startdir/src + MVDIR=$pkgdir/usr/MythVantage + mkdir -p $MVDIR/etc + install -m755 -D lighttpd-supplement.conf $pkgdir/etc/gen_light_conf.d/lighttpd-supplement.conf + install -m755 -D wakeonlan.sh $MVDIR/bin/wakeonlan.sh + # install -m755 -D backend_control.sh $MVDIR/bin/backend_control.sh + mkdir -p $pkgdir/data/srv/httpd/htdocs/ + cp -rp $startdir/contents/* $pkgdir/data/srv/httpd/htdocs + chmod -R 755 $pkgdir/data/srv/httpd/htdocs + cd $startdir + mkdir -p $pkgdir/data/srv/httpd/ + cp -rp cgi $pkgdir/data/srv/httpd/ + cd $startdir/src + install -m755 -D extra.cfg.txt $pkgdir/data/srv/httpd/cgi/extra.cfg.txt + #sudo rules + install -D -m400 $startdir/src/supplemental_web.rules $pkgdir/etc/sudoers.d/supplemental_web + chmod 750 $pkgdir/etc/sudoers.d -build() { - cd $startdir/src - mkdir -p $MVDIR/etc - install -m755 -D lighttpd-supplement.conf $MVDIR/etc/lighttpd-supplement.conf + } - install -m755 -D wakeonlan.sh $MVDIR/bin/wakeonlan.sh - install -m755 -D backend_control.sh $MVDIR/bin/backend_control.sh - mkdir -p $startdir/pkg/data/srv/httpd/htdocs/ - cp -rp $startdir/contents/* $startdir/pkg/data/srv/httpd/htdocs - chmod -R 755 $startdir/pkg/data/srv/httpd/htdocs - cd $startdir - mkdir -p $startdir/pkg/data/srv/httpd/ - cp -rp cgi $startdir/pkg/data/srv/httpd/ - cd $startdir/src - install -m755 -D extra.cfg.txt $pkgdir/data/srv/httpd/cgi/extra.cfg.txt +package_supplemental-web-slave() { + pkgdesc="supplemental-web package for slave backend" + depends=('python2' 'func' 'python_aosd' 'LinHES-system>=2-50') + conflicts="supplemental-web" + cd $startdir + mkdir -p $pkgdir/data/srv/httpd/ + cp -rp cgi $pkgdir/data/srv/httpd/ + chown -R root:root $pkgdir/data/srv/httpd/ + chmod -R 755 $pkgdir/data/srv/httpd/ + + install -m755 -D $srcdir/slaveserve.py $pkgdir/data/srv/httpd/cgi/slaveserve.py + #sudo rules + install -D -m400 $startdir/src/supplemental_slave.rules $pkgdir/etc/sudoers.d/supplemental_slave + chmod 750 $pkgdir/etc/sudoers.d + + + } -} -md5sums=('30aa4235aff78c77d544f930f3d92b62' +md5sums=('a2497205c92ad5b3aa565574afbf7f80' '3d8c7b430c1319d706ca420825918d2a' - '81cdb6ee6804fa36366c6e259a80e7b4' - 'f37e10ef9fc84b384b9a2d41f82ef744') + '26598fd1dfaf5d36d7b1f9620da5543c' + 'fabf825ca07502db40d78f0aae15f90b' + 'b41eeb0f0aa67ea06aedff61e53fa774' + 'd7be6bc265b2b9e775b090b6ac2448da') diff --git a/abs/core/supplemental-web/backend_control.sh b/abs/core/supplemental-web/backend_control.sh deleted file mode 100644 index 2cf8a49..0000000 --- a/abs/core/supplemental-web/backend_control.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -#. /etc/systemconfig -#echo $@ > /tmp/parms -#start Slavebackend: fusion 192.168.1.120 -COMMAND=$1 -BETYPE=$2 -eval LAST=\$$# -dbhost=`echo $LAST` - - -MESSAGE="" -case $COMMAND in - stop) MESSAGE=`/usr/bin/curl http://$dbhost:1337/bestop.cgi 2>/dev/null` - ;; - - start ) - MESSAGE=`/usr/bin/curl http://$dbhost:1337/bestart.cgi 2>/dev/null` - ;; - - restart) - /usr/bin/backend_control.sh stop $dbhost - sleep 2 - /usr/bin/backend_control.sh start $dbhost - ;; - clearcache) - MESSAGE2=`/usr/bin/curl http://$dbhost:1337/beclear.cgi 2>/dev/null` -esac - diff --git a/abs/core/supplemental-web/cgi/cardlist.cgi b/abs/core/supplemental-web/cgi/cardlist.cgi new file mode 100755 index 0000000..5ba7343 --- /dev/null +++ b/abs/core/supplemental-web/cgi/cardlist.cgi @@ -0,0 +1,16 @@ +#!/usr/bin/env python2 +print "Content-type: text/html" +print +exportfile = '/etc/udev/mv-persistent-video.description' +try: + f = open(exportfile,"r") + for line in f.readlines(): + if line.startswith("#"): + continue + item = line.split(":") + if len(item) <= 1 : + continue + print line +except : + print "" + print "Couldn't read static tuner map" diff --git a/abs/core/supplemental-web/cgi/diskless.py b/abs/core/supplemental-web/cgi/diskless.py index d8d960b..30dbaa7 100644 --- a/abs/core/supplemental-web/cgi/diskless.py +++ b/abs/core/supplemental-web/cgi/diskless.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 import cgi import os #http://192.168.1.200:1337/diskless.py?HOSTNAME=Envynetfe&MAC=00:0C:29:2D:08:82 diff --git a/abs/core/supplemental-web/contents/alt_index.html b/abs/core/supplemental-web/contents/alt_index.html index faf09fb..e6a89b4 100644 --- a/abs/core/supplemental-web/contents/alt_index.html +++ b/abs/core/supplemental-web/contents/alt_index.html @@ -2,8 +2,8 @@ <html> <head><title>LinHES: The Linux Home Entertainment System</title> </head> - <frameset rows="217, 80%" frameborder="no" border="3" bordercolor="#000000"> - <frame src="header.html" name="menuframe" /> + <frameset rows="230, 80%" frameborder="no" border="3" bordercolor="#000000"> + <frame src="header.html" scrolling=no name="menuframe" /> <frame src="home.shtml" name="content" /> <noframes> <body> diff --git a/abs/core/supplemental-web/contents/back.png b/abs/core/supplemental-web/contents/back.png Binary files differnew file mode 100644 index 0000000..6b5da48 --- /dev/null +++ b/abs/core/supplemental-web/contents/back.png diff --git a/abs/core/supplemental-web/contents/calllog.py b/abs/core/supplemental-web/contents/calllog.py index a96813e..0b2fb22 100644 --- a/abs/core/supplemental-web/contents/calllog.py +++ b/abs/core/supplemental-web/contents/calllog.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 # import MySQL module import MySQLdb @@ -14,32 +14,32 @@ def main(argv): # create a cursor cursor = db.cursor() # execute SQL statement - cursor.execute("select name,number,count(number) as '# calls' from cid group by number,name order by '# calls' DESC limit 20;") - result = cursor.fetchall() + # cursor.execute("select name,number,count(number) as '# calls' from cid group by number,name order by '# calls' DESC limit 20;") + # result = cursor.fetchall() + - -#Top shows + #Top 20 callers #print '<div id="content"> <p></p>' print '<div> <p></p>' print '<table class="calllog">' print "Top 20 callers" - searchstring='''<td> <a href="http://www.google.com/search?q=%s" > %s </a> </td> ''' - cursor.execute("select name,number,count(number) as '# calls' from cid group by number,name order by '# calls' DESC limit 20;") + searchstring='''<td> <a href="http://www.google.com/search?q=%s" target="_blank" > %s </a> </td> ''' + cursor.execute("select name,number,count(number) from cid group by number,name order by count(number) DESC limit 20;") result = cursor.fetchall() for row in result: print " <tr>" #print " <td>",row[0],"</td>" - print searchstring % (row[0], row [0]) + print searchstring % (row[0], row [0]) print " <td>",row[2],"</td>" #print " <td>",row[1],"</td>" - print searchstring % (row[1], row [1]) + print searchstring % (row[1], row [1]) print " </tr>" #print "%40s %26s %10s" %(row[0],row[2],row[1]) print "</table>" print "</div>" -#Top categorys - + + #last 20 calls print '<br>' print '<br>' #print '<div id="content"> <p></p>' @@ -54,9 +54,9 @@ def main(argv): print " <td> %s </td>" %(row[0]) print " <td>",row[1],"</td>" #print " <td>",row[2],"</td>" - print searchstring % (row[2], row [2]) + print searchstring % (row[2], row [2]) #print " <td>",row[3],"</td>" - print searchstring % (row[3], row [3]) + print searchstring % (row[3], row [3]) print " </tr>" # print "%26s %26s %26s %26s " %(row[0],row[1],row[2],row[3]) print "</table>" diff --git a/abs/core/supplemental-web/contents/calllog.shtml b/abs/core/supplemental-web/contents/calllog.shtml index ddf3d88..5eb5783 100644 --- a/abs/core/supplemental-web/contents/calllog.shtml +++ b/abs/core/supplemental-web/contents/calllog.shtml @@ -4,10 +4,12 @@ </head> <body> -<div id="mainContainer"> -<!-- <div id="header"><p></p></div> +<p> Phone Call Log </p> + +<!--<div id="mainContainer"> + <div id="header"><p></p></div> <div id="content"> - <p></p>--> + <p>Phone Call Log</p>--> <!--#exec cmd="/data/srv/httpd/htdocs/calllog.py" --> diff --git a/abs/core/supplemental-web/contents/cardmap.shtml b/abs/core/supplemental-web/contents/cardmap.shtml new file mode 100755 index 0000000..89013c0 --- /dev/null +++ b/abs/core/supplemental-web/contents/cardmap.shtml @@ -0,0 +1,11 @@ +<html> + <head> + <style type="text/css">@import "/frame.css";</style> + </head> + <body> + <h1> List of detected cards and static device path. </h1> + <br> + <!--#exec cmd=" MYTHCONFDIR=/usr/share/mythtv /data/srv/httpd/htdocs/list_cardmap.py" --> + </body> +</html> + diff --git a/abs/core/supplemental-web/contents/count.py b/abs/core/supplemental-web/contents/count.py index d59144a..2889af1 100644 --- a/abs/core/supplemental-web/contents/count.py +++ b/abs/core/supplemental-web/contents/count.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 # import MySQL module import MySQLdb @@ -89,4 +89,4 @@ def main(argv): print "</div>" if __name__ == "__main__": - main(sys.argv[1:])
\ No newline at end of file + main(sys.argv[1:]) diff --git a/abs/core/supplemental-web/contents/error/call_log.html b/abs/core/supplemental-web/contents/error/call_log.html index 3f05f21..d4d6333 100644 --- a/abs/core/supplemental-web/contents/error/call_log.html +++ b/abs/core/supplemental-web/contents/error/call_log.html @@ -6,6 +6,6 @@ <body> Call logging is not enabled, or no calls logs </br> -To enable logging of incoming phone calls please visit the advanced section of the service menu +To enable logging of incoming phone calls please visit the advanced section of the service menu </body> </html> diff --git a/abs/core/supplemental-web/contents/error/mythbackend.html b/abs/core/supplemental-web/contents/error/mythbackend.html new file mode 100644 index 0000000..9c3a362 --- /dev/null +++ b/abs/core/supplemental-web/contents/error/mythbackend.html @@ -0,0 +1,11 @@ +<html> +<head> +<style type="text/css">@import "/frame.css";</style> +</head> + +<body> +MythBackend status is currently unavailable. +</br> + +</body> +</html> diff --git a/abs/core/supplemental-web/contents/error/mythexpress.html b/abs/core/supplemental-web/contents/error/mythexpress.html new file mode 100644 index 0000000..0382233 --- /dev/null +++ b/abs/core/supplemental-web/contents/error/mythexpress.html @@ -0,0 +1,20 @@ +<html> +<head> +<style type="text/css">@import "/frame.css";</style> +</head> + +<body> +MythExpress is not enabled or installed. +</br> +</br> +</br> +<div id="navcontainer"> + <ul id="navlist"> + +To enable mythexpress run these commands in a terminal: + </br> + <li> pacman -Syyu mythexpress </li> + <li> add_service.sh mythexpress </li> +</ul> +</body> +</html> diff --git a/abs/core/supplemental-web/contents/error/remyth.html b/abs/core/supplemental-web/contents/error/remyth.html new file mode 100644 index 0000000..72c2775 --- /dev/null +++ b/abs/core/supplemental-web/contents/error/remyth.html @@ -0,0 +1,20 @@ +<html> +<head> +<style type="text/css">@import "/frame.css";</style> +</head> + +<body> +ReMyth is not enabled or installed. +</br> +</br> +</br> +<div id="navcontainer"> + <ul id="navlist"> + +To enable remyth run these commands in a terminal: + </br> + <li> pacman -Syyu remyth </li> + <li> add_service.sh remyth </li> +</ul> +</body> +</html> diff --git a/abs/core/supplemental-web/contents/error/zoneminder.html b/abs/core/supplemental-web/contents/error/zoneminder.html new file mode 100644 index 0000000..25ecc9b --- /dev/null +++ b/abs/core/supplemental-web/contents/error/zoneminder.html @@ -0,0 +1,20 @@ +<html> +<head> +<style type="text/css">@import "/frame.css";</style> +</head> + +<body> +Zoneminder is not enabled or installed. +</br> +</br> +</br> +<div id="navcontainer"> + <ul id="navlist"> + +To enable zoneminder run these commands in a terminal: + </br> + <li> pacman -Syyu zoneminder </li> + <li> add_service.sh zoneminder </li> +</ul> +</body> +</html> diff --git a/abs/core/supplemental-web/contents/exports.shtml b/abs/core/supplemental-web/contents/exports.shtml new file mode 100755 index 0000000..9a26dc9 --- /dev/null +++ b/abs/core/supplemental-web/contents/exports.shtml @@ -0,0 +1,20 @@ +<html> +<head> +<style type="text/css">@import "/frame.css";</style> +</head> + +<body> +<div id="mainContainer"> +<!-- <div id="header"><p></p></div> + <div id="content"> + <p></p>--> + + <!--#exec cmd="/data/srv/httpd/htdocs/list_exports.py" --> + + +</br> +</br> + +</body> +</html> + diff --git a/abs/core/supplemental-web/contents/frame.css b/abs/core/supplemental-web/contents/frame.css index eb6db98..42877dd 100644 --- a/abs/core/supplemental-web/contents/frame.css +++ b/abs/core/supplemental-web/contents/frame.css @@ -22,7 +22,7 @@ body { //-o-background-size: 1000px 10000px; //-moz-background-size: 1000px 10000px, 500px, 500px; //-webkit-background-size: 1000px 10000px, 500px 500px; - + margin: 10; margin-left:40px; padding: 10; @@ -55,11 +55,29 @@ body { /*background: #D9D9D9;*/ margin-left:60px; } + #column { float: right; /* Our column is going to be right aligned */ width: 320px; /* Our total width - content width is 260px */ /*background: #8A8AE6;*/ } + +#resultbox { + width: 700px ; + margin-left: auto ; + margin-right: auto ; + border-width: .2em; + border-style: dotted; + border-color: #900; + text-align: left; + padding-left: 30; + padding-right: 30; + padding-top: 10; + padding-bottom: 10; + +} + + #footer { clear: both; /* We have to clear our floats */ width: 760px; /* We need to set the width on the footer since it's outside the mainContainer, and therefor isn't controlled by it */ diff --git a/abs/core/supplemental-web/contents/go.png b/abs/core/supplemental-web/contents/go.png Binary files differnew file mode 100644 index 0000000..c70bf2a --- /dev/null +++ b/abs/core/supplemental-web/contents/go.png diff --git a/abs/core/supplemental-web/contents/header.html b/abs/core/supplemental-web/contents/header.html index 1e69c1c..f84b4c8 100644 --- a/abs/core/supplemental-web/contents/header.html +++ b/abs/core/supplemental-web/contents/header.html @@ -1,36 +1,74 @@ <html>
-<style type="text/css">@import "mv.css";</style>
+<!--<style type="text/css">@import "mv.css";</style>-->
+<link rel="stylesheet" type="text/css" href="skeleton.css" />
<head>
<script type="text/javascript">
-function r()
+function r()
{
current_hostname=parent.location.hostname
top.frames["content"].location.href = ( "http://" + current_hostname + ":6544" ) ;
-
-}
-</script>
+
+}
+
+function express()
+{
+ current_hostname=parent.location.hostname
+ top.frames["content"].location.href = ( "http://" + current_hostname + ":6565" ) ;
+
+ }
+
+function remyth()
+{
+ current_hostname=parent.location.hostname
+ top.frames["content"].location.href = ( "http://" + current_hostname + ":8088" ) ;
+
+ }
+
+
+</script>
</head>
<BODY BGCOLOR=#ebb81c>
-<div id='header'>
- </div>
+<div id='header'></div>
+<img id='header_img' src="linhes_header.png" alt="Alt Text" title="Image Title"/>
<base target="content" />
-<div id="navcontainer">
- <ul id="navlist">
- <li id="active"><a href="home.shtml" TARGET="content" id="current">Home</a></li>
- <li><a href="xymon" >Xymon</a></li>
- <li><a href="docs.html" >Documentation</a></li>
- <li><a href="links.html" >Links</a></li>
- <!-- <li><a href="webcal/" >Calendar</a></li> -->
- <li><a onClick=r() >Myth Backend Status</a></li>
- <li><a href="mythweb/" >MythWeb</a></li>
- <li><a href="mythexport/setup.cgi" >MythExport</a></li>
-
- <li><a href="/calllog.shtml" >Phone call log</a> </li>
-</ul>
-</div>
+<ul id="nav">
+<li><a href="home.shtml" TARGET="content" id="current">Home</a></li>
+
+<li><a href="xymon" >System »</a>
+ <ul>
+ <li><a href="/cardmap.shtml" >List static dev nodes for tuners </a></li>
+ <li><a href="/exports.shtml" >List file shares </a></li>
+ <li><a href="/xymon" >System Health</a></li>
+ <li><a href="/logs/">System Logs</a></li>
+ </ul>
+</li>
+
+<li><a href="mythweb/">Utilities »</a>
+ <ul>
+ <li><a href="mythweb/">MythWeb</a></li>
+ <li><a href="mythexport/setup.cgi">MythExport</a></li>
+ <li><a href="mythexpress.html">MythExpress</a></li>
+ <li><a href="remyth.html" >ReMyth</a></li>
+ </ul>
+</li>
+
+<li><a href="/calllog.shtml">Surveillance »</a>
+ <ul>
+ <li><a href="/calllog.shtml">Phone Call Log</a></li>
+ <li><a href="/zm">ZoneMinder</a></li>
+ </ul>
+</li>
+
+
+<li><a href="docs.html" >Documentation</a></li>
+<li><a onClick=r() >Myth Backend Status</a></li>
+
+<li><a href="links.html" >Links</a></li>
+
+
</body>
</html>
diff --git a/abs/core/supplemental-web/contents/links.html b/abs/core/supplemental-web/contents/links.html index cfc7311..e14141a 100644 --- a/abs/core/supplemental-web/contents/links.html +++ b/abs/core/supplemental-web/contents/links.html @@ -1,6 +1,3 @@ - - - <html> <head> <style type="text/css">@import "frame.css";</style> @@ -10,20 +7,17 @@ Other Links </br> - - - - <div id="navcontainer"> <ul id="navlist"> - <li><a href="/logs/" >System log files</a> </li> - <li><a href="/calllog.shtml" >Phone call log</a> </li> <!-- <li><a href="/mvpmc.shtml" >Media MVP setup</a> (dhcp server must be enabled) </li> --> <li><a href="http://www.linhes.org" >linhes.org </a>Bugtracker</li> <li><a href="http://linhes.org/wiki" >Wiki </a></li> <li><a href="http://forums.linhes.org" >Online User Forums</a></li> + <li><a href="http://linhes.org/projects/linhes/wiki/Official_and_3rd_party_add-ons" > Official & 3rd party addons</a></li> <li><a href="http://www.mythtv.org" >mythtv.org</a></li> <li><a href="http://smolt.mythtv.org" >mythtv smolt server</a></li> + <li><a href="http://www.schedulesdirect.org" >Schedules Direct guide data for North America</a></li> + </ul> diff --git a/abs/core/supplemental-web/contents/list_cardmap.py b/abs/core/supplemental-web/contents/list_cardmap.py new file mode 100755 index 0000000..4e2c1a9 --- /dev/null +++ b/abs/core/supplemental-web/contents/list_cardmap.py @@ -0,0 +1,155 @@ +#!/usr/bin/python2 +import subprocess +import socket,sys +import urllib2 +from MythTV import MythBE,MythDB,MythLog + +def find_slave_hosts(): + slave_hosts=[] + try: + be=MythBE() + db = MythDB() + cursor = db.cursor() + except: + return slave_hosts + + try: + cmd="select hostname from settings where data='Slave_backend';" + cursor.execute(cmd) + results=cursor.fetchall() + for i in results: + slave_hosts.append(i[0]) + except: + return slave_hosts + return slave_hosts + +def read_local_tuner(): + tuner_list = [] + exportfile = '/etc/udev/mv-persistent-video.description' + try: + f = open(exportfile,"r") + for line in f.readlines(): + if line.startswith("#"): + continue + item = line.split(":") + if len(item) <= 1 : + continue + tuner_list.append(item) + except : + tuner_list.append(["notfound","notfound","notfound"]) + return tuner_list + +def parse_remote_tuners(the_page): + tuner_list=[] + the_page = the_page.split("\n") + try: + for line in the_page: + if line.startswith("#"): + continue + item = line.split(":") + if len(item) <= 1 : + continue + tuner_list.append(item) + except : + tuner_list.append(["notfound","notfound","notfound"]) + return tuner_list + + +def remote_tuners(slave_host): + default_timeout = 3 + socket.setdefaulttimeout(default_timeout) + slaveurl="http://%s:1337/cardlist.cgi" %slave_host + req = urllib2.Request(slaveurl) + response = urllib2.urlopen(req) + the_page = response.read() + #the_page="abc\nadef\na" + if the_page : + tuner_list = parse_remote_tuners(the_page) + print "</br>" + for statictuner in tuner_list: + if statictuner[1].find("notfound") > -1 : + print "Couldn't open tuner map" + print "</br>" + else: + print "<li> %s  %s" %(statictuner[1] ,statictuner[0]) + print "</br>" + print " static device node: %s" %statictuner[2] + print "</br>" + print "</br>" + else: + print "<li> no tuners found  " + + return + + + +mbelist = read_local_tuner() +slave_hosts = find_slave_hosts() + +#--------------MBE------------- +hostname = socket.gethostname() +print "<h2>" +print "__________ %s __________" %(hostname) +print "</h2>" +print "</br>" +print ''' +<div id="navcontainer"> +<ul id="navlist"> +''' + +for statictuner in mbelist: + hdhr_url = None + if statictuner[1].find("notfound") > -1 : + print "Couldn't open tuner map" + print "</br>" + else: + ceton_url = None + hdhr_url = None + if statictuner[0] == "hdhr": + hdhr_url = statictuner[1].split("-")[-1] + elif statictuner[0] == "infinitv": + ceton_port = statictuner[3].strip() + #Services/1/Status.html + #print statictuner + ceton_tuner=statictuner[2].strip()[-1] + ceton_tuner = int(ceton_tuner) + 1 + ceton_url = "http://%s:%s/Services/%s/Status.html" %(hostname, + ceton_port, + ceton_tuner) + + #print "<li> %s  %s" %(statictuner[1] ,statictuner[0]) + print "<li> %s  " %(statictuner[1]) + print "</br>" + print " static device node: %s" %statictuner[2] + + if hdhr_url: + print "</br>" + print ' device webpage: <a href="http://%s">http://%s</a> ' %(hdhr_url.strip(),hdhr_url.strip()) + if ceton_url: + print "</br>" + print ' device webpage: <a href="%s">%s</a> ' %(ceton_url.strip(),ceton_url.strip()) + print "</br>" + print "</br>" + +print '''</ul> </div>''' + +#---------Slave tuners +for i in slave_hosts: + print "<h2>" + print "__________ %s __________" %(i) + print "</h2>" + print "</br>" + print ''' + <div id="navcontainer"> + <ul id="navlist" ''' + #remote_tuners(i) + try: + remote_tuners(i) + pass + except: + print "</br>" + print "<li> Problem reading list from %s" %i + pass + print ''' </ul> </div>''' + + diff --git a/abs/core/supplemental-web/contents/list_exports.py b/abs/core/supplemental-web/contents/list_exports.py new file mode 100755 index 0000000..13ec690 --- /dev/null +++ b/abs/core/supplemental-web/contents/list_exports.py @@ -0,0 +1,82 @@ +#!/usr/bin/python2 +import subprocess + +def nfs_export_list(): + nfslist = [] + exportfile = "/etc/exports" + proc = subprocess.Popen(["showmount", "-a"] , stdout=subprocess.PIPE,stderr=subprocess.PIPE) + stdout,stderr = proc.communicate() + rc = proc.returncode + if rc == 0: + try: + f = open(exportfile,"r") + for line in f.readlines(): + if line.startswith("#"): + continue + item = line.split() + if len(item) <= 1 : + continue + nfslist.append(item) + except : + pass + else: + nfslist.append(["NFS server is not running",'NFS server is not running']) + return nfslist + + +def smb_share_list(): + smblist=[] + + proc = subprocess.Popen(["smbclient", "-L", "\\localhost" , "-N"], stdout=subprocess.PIPE,stderr=subprocess.PIPE) + stdout,stderr = proc.communicate() + outstuff = stderr.split("\n") + for line in outstuff: + try: + heading1 = line.split()[0] + except: + continue + #print heading1 + #print heading1.find("Domain") + if heading1.find("Domain") > -1 : + #smblist.append('') + smblist.append(heading1) + break + + outstuff = stdout.split("\n") + for line in outstuff: + try: + heading1,heading2 = line.split() + except: + continue + if heading1 == "Server" and heading2 == "Comment": + break + smblist.append(line) + + return smblist + + +nfslist = nfs_export_list() +smblist = smb_share_list() + + +print "---------NFS SHARES-----------\n" +print "</br>" +for sharename in nfslist: + if sharename[1].find("noaccess") > -1 : + print "%s \t no access" %sharename[0] + print "</br>" + else: + print sharename[0] + print "</br>" + +print "\n---------SMB SHARES----------\n" +print "</br>" + +if len(smblist) == 0: + print "Samba is not running or no shares listed" + print "</br>" +else: + for sharename in smblist: + print "%s" %(sharename.split()[0]) + print "</br>" + diff --git a/abs/core/supplemental-web/contents/mythweb.html b/abs/core/supplemental-web/contents/mythweb.html new file mode 100644 index 0000000..fe76a9a --- /dev/null +++ b/abs/core/supplemental-web/contents/mythweb.html @@ -0,0 +1,16 @@ +<html> +<head> +<style type="text/css">@import "/frame.css";</style> +</head> + +<body> +MythWeb does not appear to be installed. +</br> +To install MythWeb either +</br> +1) Visit the MythVantage advanced screen to enable mythweb. </br> +2) type "pacman -S mythweb-release-fixes" at the console. + + +</body> +</html> diff --git a/abs/core/supplemental-web/contents/process.py b/abs/core/supplemental-web/contents/process.py index 9098ad6..988ebfc 100644 --- a/abs/core/supplemental-web/contents/process.py +++ b/abs/core/supplemental-web/contents/process.py @@ -1,9 +1,11 @@ -#!/usr/bin/python +#!/usr/bin/python2 import sys import cgi import os import socket import time +import StringIO + try: import cgitb cgitb.enable() @@ -45,10 +47,10 @@ def getform(theform, valuelist, notpresent='', nolist=False): 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: @@ -100,32 +102,81 @@ def go_backup(myhost): myhostname = socket.gethostname() results="Nothing happened" command= "sudo /usr/LH/bin/lh_system_backup_job" - print command - command2="sleep 1; /data/srv/hobbit/server/ext/hbnotes.py" + #print command + + command2="sleep 1; sudo -u nobody /home/xymon/server/ext/hbnotes.py" results=os.popen(command,'r') os.popen(command2,'r') return results -def go_restore(restorefile,myhost): +def go_download_backup(dl_file): + # Actual File Content will go hear. + dlf = "/data/storage/disk0/backup/system_backups/%s" %dl_file + fo = open(dlf, "rb") + + str = fo.read() + fo.close() + + # HTTP Header + print "Content-Type:application/octet-stream; name=\"%s\"\r\n;" %(dl_file) + print "Content-Disposition: attachment; filename=\"%s\"\r\n;" %(dl_file) + print "Content-Length: %d" % len(str) + print "" + + print str + return results + + +def go_restore(restorefile,myhost,prestore): myhostname = socket.gethostname() + psc = '' + if prestore == "on": + psc = "partial" + + if myhostname.strip() == myhost.strip(): - localcommand="sudo /usr/bin/restore_job.sh " - command= localcommand + restorefile + command="sudo /usr/LH/bin/lh_system_restore_job %s %s" %(restorefile , psc) + + + else: + #this should never execute sshcmd="ssh -o StrictHostKeyChecking=no -o ConnectTimeout=1 -i /data/srv/.nobody_ssh/id_dsa mythtv@" sshcmd+=myhost.strip() cmd=' "sudo /usr/bin/restore_job.sh " ' command=sshcmd + cmd + restorefile + " 2>&1 " - + #print command results=os.popen(command,'r') return results +def go_upload(up_file): + saveDir = "/data/storage/disk0/backup/system_backups/" + fPath = "%s/%s" % (saveDir, up_file.filename) + buf = up_file.file.read() + bytes = len(buf) + sFile = open(fPath, 'wb') + sFile.write(buf) + sFile.close() + results=["<b>%s</b> uploaded (%d bytes)." %(up_file.filename, bytes)] + line = '''The backup has been uploaded and is now available for restore. + To restore from the file, check "Restore database" then select the file from the drop down menu''' + + + results.append(line) + + command2="sleep 1; sudo -u nobody /home/xymon/server/ext/hbnotes.py" + os.popen(command2,'r') + + + return results + + def go_optimize(myhost): #myhostname = socket.gethostname() #if myhostname.strip() == myhost.strip(): command="/usr/LH/bin/optimize_mythdb.py" - print command + #print command results=os.popen(command,'r') #else: #results='This host does not run a database' @@ -135,17 +186,17 @@ def go_update(myhost,update_type): cmd=" call pacman update_system " cmd+=update_type command="/usr/bin/func \"" + myhost.strip() + "*\" " + cmd - print command + #print command results=os.popen(command,'r') return results def go_updateall(allupdate_type): - cmd=" sudo /usr/bin/update_system_all " - cmd+=allupdate_type - command= cmd + " 2>&1 " - results=os.popen(command,'r') - return results + cmd=" sudo /usr/bin/update_system_all " + cmd+=allupdate_type + command= cmd + " 2>&1 " + results=os.popen(command,'r') + return results def go_shutdown(myhost): @@ -207,6 +258,9 @@ def go_kill(myhost,kill_type): return results + + + mainpage = ''' <html><head> <style type="text/css">@import "/frame.css";</style> @@ -221,11 +275,12 @@ error = ''' result = ''' <h1>%s of %s</h1> ''' -possible_parameters = ['param1', 'param2', 'param3', 'param4','hiddenparam','param5','param6'] +possible_parameters = ['param1', 'param2', 'param3', 'param4','hiddenparam','param5','param6','param7','uFile','param8'] if __name__ == '__main__': - cgiprint(contentheader) # content header - cgiprint() # finish headers with blank line + + #cgiprint(contentheader) # content header + #cgiprint() # finish headers with blank line theform = cgi.FieldStorage() #print theform @@ -244,19 +299,31 @@ if __name__ == '__main__': hidden = formdict['hiddenparam'] all_update_type=formdict['param5'] kill_type = formdict['param6'] + dl_file = formdict['param7'] + try: + up_file = theform['uFile'] + except: + pass + try: + prestore = theform['param8'].value + except: + prestore = "off" body = result % (radio, hidden) - print mainpage % body + #print mainpage % body selection=radio myhost=hidden.lower() if selection == "Restore": - mylogfile=go_restore(name,myhost) + mylogfile=go_restore(name,myhost,prestore) elif selection == "Backup": mylogfile=go_backup(myhost) + elif selection == "Dbackup": + mylogfile=go_download_backup(dl_file) + elif selection == "Update": mylogfile=go_update(myhost,update_type) elif selection == "Shutdown": @@ -273,14 +340,25 @@ if __name__ == '__main__': mylogfile=go_shutdownall() elif selection == "Kill": mylogfile=go_kill(myhost,kill_type) + elif selection == "Upload": + mylogfile = go_upload(up_file) + + + cgiprint(contentheader) # content header + cgiprint() # finish headers with blank line + print mainpage % body + + #box=''' </br> </br> + #<div style="border: 1px solid #aaa; width:700px; height:700px; overflow:auto; color:#FFF;text-align:left;"> + #<code id="box" style="display: block; height: 700px; width: 700px; overflow: auto;"> + #''' + box='''</br> </br> + <div id="resultbox" > - box=''' </br> </br> - <div style="border: 1px solid #aaa; width:700px; height:700px; overflow:auto; color:#FFF;text-align:left;"> - <code id="box" style="display: block; height: 700px; width: 700px; overflow: auto;"> ''' endbox=''' - </code> + </div> ''' javascript=''' @@ -295,7 +373,11 @@ if __name__ == '__main__': print line + '</br> \r\n' print endbox - print '<a href=', oldurl, ' > Back </a> ' + print "</br></br>" + #print '<a href=', oldurl, ' > Back </a> ' + s='<a href="%s"><img src="back.png"></a>' %oldurl + print s + #<a href="myfile.htm"><img src="rainbow.gif"></a> #print oldurl print javascript diff --git a/abs/core/supplemental-web/contents/skeleton.css b/abs/core/supplemental-web/contents/skeleton.css new file mode 100644 index 0000000..b13aa20 --- /dev/null +++ b/abs/core/supplemental-web/contents/skeleton.css @@ -0,0 +1,103 @@ +/* ================================================================
+This copyright notice must be untouched at all times.
+
+The original version of this stylesheet and the associated (x)html
+is available at http://www.stunicholls.com/menu/skeleton_up.html
+Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
+This stylesheet and the associated (x)html may be modified in any
+way to fit your requirements.
+=================================================================== */
+#header_img {margin:5px auto;display:block;}
+
+#nav,
+#nav ul {padding:0 0 5px 0; margin:0; list-style:none;
+ /*font: 14px verdana, sans-serif;*/
+ /*font: 14px verdana, sans-serif;*/
+ border:1px solid #000;
+ border-color:#ace #79b #68a #bde;
+ border-width:1px 2px 2px 1px; background:#fff;
+ position:relative; z-index:200;}
+
+#nav {height:30px; padding:0;background-color:#0072bc;}
+
+#nav li {float:left;}
+#nav li li {float:none; background:#fff;}
+/* a hack for IE5.x and IE6 */
+* html #nav li li {float:left;}
+
+
+
+
+#nav li a {display:block; float:left;
+ color:#FFFFFF; margin:0 25px 0 10px;
+ height:25px; line-height:25px;
+ text-decoration:none; white-space:nowrap;
+}
+
+/*item in white box*/
+#nav li li a {height:20px; line-height:20px; float:none;
+ background-color:#0072bc;
+ margin:0 0 0 0;
+ border:1px solid #000;
+ /*border-color:#ace #79b #68a #bde;*/
+ border-color:#0072bc;
+ border-width:3px 3px 3px 3px; background:#0072bc;
+ }
+
+#nav li:hover {position:relative; z-index:300; }
+
+/*white box*/
+#nav li:hover ul {left:0; bottom:21px; top:auto; background-color:#0072bc; color:}
+
+/* another hack for IE5.5 and IE6 */
+* html #nav li:hover ul {left:10px;}
+
+
+#nav ul {position:absolute;
+ left:-9999px;
+ top:-9999px;
+}
+/* yet another hack for IE5.x and IE6 */
+* html #nav ul {width:1px;}
+
+/* it could have been this simple if all browsers understood */
+/* show next level */
+#nav li:hover li:hover > ul {left:-15px; margin-left:100%; bottom:-7px; top:auto;}
+/* keep further levels hidden */
+#nav li:hover > ul ul {position:absolute; left:-9999px; top:-9999px; width:auto;}
+/* show path followed */
+
+#nav li:hover > a {text-decoration:underline; }
+
+
+/* but IE5.x and IE6 need this lot to style the flyouts and path followed */
+/* show next level */
+#nav li:hover li:hover ul,
+#nav li:hover li:hover li:hover ul,
+#nav li:hover li:hover li:hover li:hover ul,
+#nav li:hover li:hover li:hover li:hover li:hover ul
+{left:-15px; margin-left:100%; bottom:-7px; top:auto;}
+
+/* keep further levels hidden */
+#nav li:hover ul ul,
+#nav li:hover li:hover ul ul,
+#nav li:hover li:hover li:hover ul ul,
+#nav li:hover li:hover li:hover li:hover ul ul
+{position:absolute; left:-9999px; top:-9999px;}
+
+/* show path followed */
+#nav li:hover a,
+#nav li:hover li:hover a,
+#nav li:hover li:hover li:hover a,
+#nav li:hover li:hover li:hover li:hover a,
+#nav li:hover li:hover li:hover li:hover li:hover a,
+#nav li:hover li:hover li:hover li:hover li:hover li:hover a
+{text-decoration:underline; color:#ebb81c;}
+
+/* hide futher possible paths */
+#nav li:hover li a,
+#nav li:hover li:hover li a,
+#nav li:hover li:hover li:hover li a,
+#nav li:hover li:hover li:hover li:hover li a,
+#nav li:hover li:hover li:hover li:hover li:hover li a
+{text-decoration:none; color:#FFFFFF;}
diff --git a/abs/core/supplemental-web/grabkey.py b/abs/core/supplemental-web/grabkey.py index 66d630b..d079607 100644 --- a/abs/core/supplemental-web/grabkey.py +++ b/abs/core/supplemental-web/grabkey.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 #polls the hobbit server for ghost clients. If it finds ghosts it will make a new bb-hosts file #with the new clients. #Will not add duplicate clients @@ -9,103 +9,118 @@ import sys import os def readkeyfile(): - global keylist - try: - infile = open('/data/home/mythtv/.ssh/authorized_keys', 'r') - except(IOError), e: - keylist='' - else: - keylist = infile.readlines() - infile.close() + global keylist + global data_config + try: + f = "%s/.ssh/authorized_keys" %data_config.MYTHHOME + infile = open(f, 'r') + except(IOError), e: + keylist='' + else: + keylist = infile.readlines() + infile.close() def grabkey(server): - global numberlines - global mbekey - url="http://" + server + ":1337/serverkey.cgi" - - try: - f = urllib2.urlopen(url) - except urllib2.HTTPError, e: - if e.code != 200: - print 'error find key' - sys.exit(1) - else: - mbekey = f.readlines() - f.close() + global numberlines + global mbekey + global data_config + url="http://" + server + ":1337/serverkey.cgi" + + try: + f = urllib2.urlopen(url) + except urllib2.HTTPError, e: + if e.code != 200: + print 'error find key' + sys.exit(1) + else: + mbekey = f.readlines() + f.close() numberlines = len(mbekey) #print mbekey def makenewkeyfile(): - global keylist - global mbekey - global numberlines - global numinserts - numinserts=0 - outlist = [] - for item in keylist: - if item not in outlist: - outlist.append(item) - - for item in mbekey: + global keylist + global mbekey + global numberlines + global numinserts + global data_config + numinserts=0 + outlist = [] + for item in keylist: + if item not in outlist: + outlist.append(item) + + for item in mbekey: # line = item.rstrip() - #nline = "%s #" % (line) - #nline = nline + '\n' - if item not in outlist: - outlist.append(item) - #print "adding: " + item - numinserts = numinserts + 1 - if numinserts > 0: - try: - outfile = open("/data/home/mythtv/.ssh/authorized_keys","w") - except(IOError), e: - os.system('mkdir -p /data/home/mythtv/.ssh') - outfile = open("/data/home/mythtv/.ssh/authorized_keys","w") - for i in outlist: - outfile.write(i + '\n' ) - outfile.close - os.system('chown -R mythtv /data/home/mythtv/.ssh') - os.system('chmod 700 /data/home/mythtv/.ssh/authorized_keys') - + #nline = "%s #" % (line) + #nline = nline + '\n' + if item not in outlist: + outlist.append(item) + #print "adding: " + item + numinserts = numinserts + 1 + if numinserts > 0: + f = "%s/.ssh/authorized_keys" %data_config.MYTHHOME + try: + outfile = open(f,"w") + except(IOError), e: + os.system('mkdir -p %s/.ssh' %data_config.MYTHHOME) + outfile = open(f,"w") + for i in outlist: + outfile.write(i + '\n' ) + outfile.close + os.system('chown -R mythtv %s/.ssh' %data_config.MYTHHOME ) + os.system('chmod 700 %s' %f) + global infile global keylist global numberlines global numinserts global mbekey +global data_config +sys.path.append('/usr/MythVantage/bin/') +config_file = "mv_config" +data_config = __import__(config_file, globals(), locals(), []) + + + numinserts = 0 readkeyfile() #print numberlines #print mbekey +#data_config.MYTHHOME + + try: - infile = open('/etc/systemconfig', 'r') + infile = open('/etc/systemconfig', 'r') except(IOError), e: - sys.exit(1) + sys.exit(1) else: - keylist = infile.readlines() - infile.close() + keylist = infile.readlines() + infile.close() for item in keylist: - if item.startswith("dbhost"): - itemlist=item.split("=") - server=itemlist[1].strip() - server=server.rstrip() - server=server.strip('"') - server=server.rstrip('"') + if item.startswith("dbhost"): + itemlist=item.split("=") + server=itemlist[1].strip() + server=server.rstrip() + server=server.strip('"') + server=server.rstrip('"') grabkey(server) if numberlines > 0: - makenewkeyfile() + makenewkeyfile() else: - print "nothing to add" + print "nothing to add" if numinserts < 1: - sys.exit(1) + sys.exit(1) else: - sys.exit(0) + sys.exit(0) diff --git a/abs/core/supplemental-web/lighttpd-supplement.conf b/abs/core/supplemental-web/lighttpd-supplement.conf index 24e1b4a..a86cfc6 100644 --- a/abs/core/supplemental-web/lighttpd-supplement.conf +++ b/abs/core/supplemental-web/lighttpd-supplement.conf @@ -20,15 +20,29 @@ server.error-handler-404 = "/error/mythexport.html" $HTTP["url"] =~ "(call_log)" { server.error-handler-404 = "/error/call_log.html" } + +$HTTP["url"] =~ "(mythexpress)" { + server.error-handler-404 = "/error/mythexpress.html" +} + +$HTTP["url"] =~ "(remyth)" { + server.error-handler-404 = "/error/remyth.html" +} + + +$HTTP["url"] =~ "(zm)" { + server.error-handler-404 = "/error/zoneminder.html" + } + ## error-handler for status 404 #server.error-handler-404 = "/error-handler.html" server.errorfile-prefix = "/data/srv/httpd/htdocs/error/status-" -alias.url = ( "/logs/" => "/var/log/" ) +alias.url += ( "/logs/" => "/var/log/" ) $HTTP["url"] =~ "^/logs($|/)" { -dir-listing.activate= "enable" -dir-listing.hide-dotfiles = "enable" -dir-listing.external-css = "/frame.css" + dir-listing.activate= "enable" + dir-listing.hide-dotfiles = "enable" + dir-listing.external-css = "/frame.css" } @@ -41,7 +55,7 @@ dir-listing.external-css = "/frame.css" $SERVER["socket"] == ":1337" { server.document-root = "/data/srv/httpd/cgi/" - alias.url = ( "/templates/" => "/data/home/mythtv/templates/" ) + alias.url = ( "/templates/" => "/home/mythtv/templates/" ) } diff --git a/abs/core/supplemental-web/slaveserve.py b/abs/core/supplemental-web/slaveserve.py new file mode 100644 index 0000000..c1d9ae7 --- /dev/null +++ b/abs/core/supplemental-web/slaveserve.py @@ -0,0 +1,13 @@ +#!/usr/bin/python2 +import CGIHTTPServer +import BaseHTTPServer + +class Handler(CGIHTTPServer.CGIHTTPRequestHandler): + cgi_directories = ["/"] + +PORT = 1337 + +httpd = BaseHTTPServer.HTTPServer(("", PORT), Handler) +#print "serving at port", PORT +httpd.serve_forever() + diff --git a/abs/core/supplemental-web/supplemental-web.install b/abs/core/supplemental-web/supplemental-web.install index 7dc0214..55101ba 100644 --- a/abs/core/supplemental-web/supplemental-web.install +++ b/abs/core/supplemental-web/supplemental-web.install @@ -8,15 +8,9 @@ pre_install() { # arg 1: the new package version post_install() { - /bin/true - - COUNT=`grep -c "lighttpd-supplement.conf" /etc/lighttpd/conf.include` - if [ $COUNT == 0 ] - then - echo "==> Adding lighttpd-suppliement.conf to conf.include" - echo "include \"/usr/MythVantage/etc/lighttpd-supplement.conf\"" >> /etc/lighttpd/conf.include - fi - echo + setfacl -m u:http:rx /home/mythtv/ + setfacl -m u:http:rwx /data/storage/disk0/backup/system_backups/ + gen_light_include.py echo "==> Forcing a re-read of lighttpd's configuration file." echo "" /sbin/sv hup /service/lighttpd @@ -44,21 +38,11 @@ pre_remove() { # arg 1: the old package version post_remove() { - /bin/true - COUNT=`grep -c "lighttpd-supplement.conf" /etc/lighttpd/conf.include` - if [ $COUNT -gt 0 ] - then - echo "==> Removing lighttpd-supplement.conf from conf.include" - sed -i 's#include \"/usr/MythVantage/etc/lighttpd-supplement.conf\"##' -i /etc/lighttpd/conf.include - fi - - - echo + gen_light_include.py + echo echo "==> Forcing a re-read of lighttpd's configuration file." echo "" - /sbin/sv hup /service/lighttpd - - + /sbin/sv hup /service/lighttpd /usr/LH/bin/switch_web.sh local } diff --git a/abs/core/supplemental-web/supplemental_slave.rules b/abs/core/supplemental-web/supplemental_slave.rules new file mode 100644 index 0000000..4445fd5 --- /dev/null +++ b/abs/core/supplemental-web/supplemental_slave.rules @@ -0,0 +1,2 @@ +#These rules are used by supplemental-web-slave +http ALL = NOPASSWD:/sbin/sv diff --git a/abs/core/supplemental-web/supplemental_web.rules b/abs/core/supplemental-web/supplemental_web.rules new file mode 100644 index 0000000..f860c3e --- /dev/null +++ b/abs/core/supplemental-web/supplemental_web.rules @@ -0,0 +1,3 @@ +#These rules are used by supplemental-web +http ALL = NOPASSWD:/usr/sbin/etherwake +http ALL = (nobody) NOPASSWD:/home/xymon/server/ext/hbnotes.py diff --git a/abs/core/supplemental-web/wakeonlan.sh b/abs/core/supplemental-web/wakeonlan.sh index 1213f79..7734401 100644 --- a/abs/core/supplemental-web/wakeonlan.sh +++ b/abs/core/supplemental-web/wakeonlan.sh @@ -1,12 +1,17 @@ #!/bin/bash -HWADDR=`curl -s http://localhost/xymon/hobbit-cgi/svcstatus.sh?CLIENT=$1|grep HWaddr|tr -s [:space:]| cut -d" " -f5|uniq` - -#for mac in `grep HW "$DIR/$FILE" |awk '{ print $5 } '` +echo "Wake on lan attempt for $1" +HWADDR=`curl -s http://localhost/xymon/hobbit-cgi/svcstatus.sh?CLIENT=$1|grep ether|grep txq|tr -s [:space:]| cut -d" " -f3|uniq` for mac in $HWADDR do - echo "/usr/bin/wol -v $mac" - /usr/bin/wol -v $mac + echo + echo "####################################################" + echo "wol: $mac" + /usr/bin/wol -v $mac + echo + echo "etherwake: $mac " + sudo /usr/sbin/etherwake -D $mac 2>&1 + echo "####################################################" done - + |