summaryrefslogtreecommitdiffstats
path: root/abs/core/supplemental-web/contents
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2012-09-20 21:11:14 (GMT)
committerJames Meyer <james.meyer@operamail.com>2012-09-20 21:11:14 (GMT)
commit82fbaf24ecc0374bd5dd457c118e1a0affffaa83 (patch)
tree5233f1c70d6008be4834c9006fc2a911f17b8d53 /abs/core/supplemental-web/contents
parent24f531c22f8c07112d4d71ae37f6f65a85f6e815 (diff)
downloadlinhes_pkgbuild-82fbaf24ecc0374bd5dd457c118e1a0affffaa83.zip
linhes_pkgbuild-82fbaf24ecc0374bd5dd457c118e1a0affffaa83.tar.gz
linhes_pkgbuild-82fbaf24ecc0374bd5dd457c118e1a0affffaa83.tar.bz2
supplemental-web: add ability to list all known exported file systems
Diffstat (limited to 'abs/core/supplemental-web/contents')
-rwxr-xr-xabs/core/supplemental-web/contents/exports.shtml20
-rw-r--r--abs/core/supplemental-web/contents/links.html1
-rwxr-xr-xabs/core/supplemental-web/contents/list_exports.py82
3 files changed, 103 insertions, 0 deletions
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/links.html b/abs/core/supplemental-web/contents/links.html
index cfc7311..883c273 100644
--- a/abs/core/supplemental-web/contents/links.html
+++ b/abs/core/supplemental-web/contents/links.html
@@ -24,6 +24,7 @@ Other Links
<li><a href="http://forums.linhes.org" >Online User Forums</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="/exports.shtml" >List file shares </a></li>
</ul>
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>"
+