# HG changeset patch # User Christophe Lincoln # Date 1307849615 -7200 # Node ID d11a314ab78c8aca853e36e1ece87ebbf92d2f23 # Parent 7837967d85139c01cf3d711753edc7ab64903d0a Add small server CGI SHell web interface diff -r 7837967d8513 -r d11a314ab78c README --- a/README Sun Jun 12 05:27:00 2011 +0200 +++ b/README Sun Jun 12 05:33:35 2011 +0200 @@ -83,8 +83,7 @@ plan for a users files web interface since security if more important, actually user home have 0700 mode as so standard web server running user www can't see the files. We may implemnt a HTTP Public dir wich coul handle xHTML pages, a -wiki, etc. Actually they is some work on a Ssfs server web interface with the -goal to provide service status an information. +wiki, etc. Get configs on boot @@ -159,6 +158,13 @@ login name. +Server web interface +-------------------- +Ssfs package provide a small CGI SHell web interface to the server. The goal +to provide service status an information. It use the server configuration to +know Ssfs virtual disk path and display statistics about the filesystem. + + Development and Bugs -------------------- If you want to install the latest code to test and help in development you can diff -r 7837967d8513 -r d11a314ab78c web/ssfs.cgi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/ssfs.cgi Sun Jun 12 05:33:35 2011 +0200 @@ -0,0 +1,99 @@ +#!/bin/sh +# +echo "Content-Type: text/html" +echo "" + +. /etc/ssfs/ssfs-server.conf + +notes=/var/cache/ssfs-server.notes +root=$SSFS_CHROOT +vdisk=$(basename $SSFS_VDISK) +vsize=$(du -sh $SSFS_VDISK | awk '{print $1}') +vused=$(du -sh $root | awk '{print $1}') +users=$(ls $root/home | wc -l) +pct=$(df $root | fgrep $root | awk '{print $5}') +tz=$(cat /etc/TZ) +date=$(date "+%Y-%m-%d %H:%M") + +# XHTML footer function. +xhtml_footer() { + cat << EOT + + + + + + +EOT +} + +# xHTML 5 header. +cat << EOT + + + + Ssfs Server + + + + + + +EOT + +case ${QUERY_STRING} in + doc) + # Open a dic for content but keep small margins. + echo '
' + echo '

Ssfs Documentation

' + echo '
'
+		cat /usr/share/doc/ssfs/README | sed \
+			-e s"#^[\#|\$]\([^']*\)#\0#"g \
+			-e s"#http://\([^']*\).*#\0#"g
+		echo '
' + xhtml_footer && exit 0 ;; +esac + +# Content +cat << EOT +

Ssfs Server

+ +
+ +

Hostname $(hostname)

+
+Server time   : $date
+Time zone     : $tz
+
+ +

Virtual disk stats

+
+Virtual disk  : $vdisk
+Ssfs root     : $root
+Vdisk size    : $vsize
+Vdisk usage   : $vused
+Vdisk users   : $users
+
+ +
+
$pct
+
+

+ Filesystem usage provided by 'df' include ext3 reserved space. +

+ +EOT + +# Server admin notes for users. +if [ -f "$notes" ]; then + echo '

Server side notes

' + echo '
'
+	cat $notes | sed s"#http://\([^']*\).*#\0#"g
+	echo '
' +fi + +xhtml_footer +exit 0 diff -r 7837967d8513 -r d11a314ab78c web/style.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/style.css Sun Jun 12 05:33:35 2011 +0200 @@ -0,0 +1,14 @@ +/* CSS style fro Ssfs */ + +html { height: 102%; } +body { font-size: 96%; margin: 0 40px; } +h1 { color: #351a0a; border-bottom: 1px dotted #ddd; } +h2 { color: #444; font-size: 130%; } +pre { font-size: 110%; } +pre, .box { + padding: 10px; background: #f1f1f1; + border: 1px solid #ddd; border-radius: 4px; +} +#content { margin: 0 10%; } +#footer { color: #888; text-align: center; padding: 40px; } +#footer a { color: #888; }