From f7817cd6d6bc524fbce673ec68ebe7efab8e4a46 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Wed, 21 Dec 2011 15:07:15 -0600 Subject: supplemental-web: add backend_control.sh and cleanup the cgi scripts --- abs/core/supplemental-web/PKGBUILD | 10 +++++++--- abs/core/supplemental-web/backend_control.sh | 28 ++++++++++++++++++++++++++++ abs/core/supplemental-web/cgi/beclear.cgi | 2 +- abs/core/supplemental-web/cgi/bestart.cgi | 6 ++++++ abs/core/supplemental-web/cgi/bestop.cgi | 8 +++++--- 5 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 abs/core/supplemental-web/backend_control.sh create mode 100644 abs/core/supplemental-web/cgi/bestart.cgi diff --git a/abs/core/supplemental-web/PKGBUILD b/abs/core/supplemental-web/PKGBUILD index 6df239b..7c30873 100644 --- a/abs/core/supplemental-web/PKGBUILD +++ b/abs/core/supplemental-web/PKGBUILD @@ -1,6 +1,6 @@ pkgname=supplemental-web pkgver=1.0 -pkgrel=9 +pkgrel=10 arch=('i686') MVDIR=$startdir/pkg/usr/MythVantage #BINDIR=$MVDIR/bin @@ -9,7 +9,7 @@ install=supplemental-web.install #binfiles="saytime.sh backup_job restore_job.sh update_system update_system_all backend_control.sh grabkey.py notify.py" #source=($binfiles mfegdbcommands.txt mbegdbcommands.txt 45-event.rules lighttpd-supplement.conf) backup=('extra.cfg.txt') -source=(lighttpd-supplement.conf extra.cfg.txt wakeonlan.sh) +source=(lighttpd-supplement.conf extra.cfg.txt wakeonlan.sh backend_control.sh notify.py) depends=('lighttpd' 'php' 'fcgi' 'python' 'xymonserver' 'certmaster' 'func' 'python_aosd' ) @@ -22,6 +22,8 @@ build() { 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 +# install -m755 -D notify.py $MVDIR/bin/notify.py 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 @@ -37,4 +39,6 @@ build() { md5sums=('2a9d042467220fd1f74f5b12730c2e06' '3d8c7b430c1319d706ca420825918d2a' - '81cdb6ee6804fa36366c6e259a80e7b4') + '81cdb6ee6804fa36366c6e259a80e7b4' + 'f37e10ef9fc84b384b9a2d41f82ef744' + '4da05325b4f9d61d26f88c19578d1950') diff --git a/abs/core/supplemental-web/backend_control.sh b/abs/core/supplemental-web/backend_control.sh new file mode 100644 index 0000000..2cf8a49 --- /dev/null +++ b/abs/core/supplemental-web/backend_control.sh @@ -0,0 +1,28 @@ +#!/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/beclear.cgi b/abs/core/supplemental-web/cgi/beclear.cgi index 40c0cec..489466d 100644 --- a/abs/core/supplemental-web/cgi/beclear.cgi +++ b/abs/core/supplemental-web/cgi/beclear.cgi @@ -1,4 +1,4 @@ #!/bin/bash -/usr/local/bin/mythbackend --clearcache +/usr/bin/mythbackend --clearcache MESSAGE="settings cache is cleared " #/usr/bin/notify.py SYS "$MESSAGE" 2>/dev/null diff --git a/abs/core/supplemental-web/cgi/bestart.cgi b/abs/core/supplemental-web/cgi/bestart.cgi new file mode 100644 index 0000000..10ca4ad --- /dev/null +++ b/abs/core/supplemental-web/cgi/bestart.cgi @@ -0,0 +1,6 @@ +#!/bin/bash +sudo /sbin/sv start mythbackend +MESSAGE="`hostname` B.E. started" +/usr/bin/func "*" call msg display "$MESSAGE" & + + diff --git a/abs/core/supplemental-web/cgi/bestop.cgi b/abs/core/supplemental-web/cgi/bestop.cgi index e45e74d..a65a16a 100644 --- a/abs/core/supplemental-web/cgi/bestop.cgi +++ b/abs/core/supplemental-web/cgi/bestop.cgi @@ -1,6 +1,8 @@ #!/bin/bash -sudo /sbin/sv stop mythbackend > /dev/null +sudo /sbin/sv stop mythbackend MESSAGE="`hostname` B.E. stopped" +/usr/bin/func "*" call msg display "$MESSAGE" & + + + -#echo $MESSAGE -/usr/bin/notify.py NFO "$MESSAGE" 2>/dev/null -- cgit v0.12