From 3b28797a23d17cdf9960b0661516c262a8284354 Mon Sep 17 00:00:00 2001 From: James Meyer <james.meyer@operamail.com> Date: Fri, 27 Feb 2009 10:34:01 -0600 Subject: Add new modules fe_restart.py. Whitespace cleanup --- abs/mv-core/func/PKGBUILD | 6 +++--- abs/mv-core/func/fe_restart.py | 35 +++++++++++++++++++++++++++++++++++ abs/mv-core/func/power.py | 8 ++++---- 3 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 abs/mv-core/func/fe_restart.py diff --git a/abs/mv-core/func/PKGBUILD b/abs/mv-core/func/PKGBUILD index 9e4a598..96eafce 100644 --- a/abs/mv-core/func/PKGBUILD +++ b/abs/mv-core/func/PKGBUILD @@ -1,6 +1,6 @@ pkgname=func pkgver=0.24 -pkgrel=9 +pkgrel=21 pkgdesc="fedora unifed network controller" url="" license="gpl" @@ -11,13 +11,12 @@ replaces=() backup=() moddir="pkg/usr/lib/python2.6/site-packages/func/minion/modules/" install=func.install -source=($pkgname-$pkgver.tar.gz minion.conf power.py pacman.py failed_func.sh) +source=($pkgname-$pkgver.tar.gz minion.conf power.py pacman.py failed_func.sh fe_restart.py) md5sums=() arch=('i686') build() { cd $startdir/src/$pkgname-${pkgver} - cd $startdir/src/func python setup.py build python setup.py install --prefix=$startdir/pkg/usr cd $startdir/src @@ -27,6 +26,7 @@ build() { install -m755 -D $startdir/src/$pkgname-${pkgver}/etc/Test.conf $startdir/pkg/etc/func/modules/Test.conf install -m755 -D $startdir/src/power.py ${startdir}/${moddir}/power.py install -m755 -D $startdir/src/pacman.py ${startdir}/${moddir}/pacman.py + install -m755 -D $startdir/src/fe_restart.py ${startdir}/${moddir}/fe_restart.py install -m755 -D $startdir/src/failed_func.sh $startdir/pkg/usr/bin/failed_func.sh mkdir -p $startdir/pkg/var/log/func cd $startdir/pkg diff --git a/abs/mv-core/func/fe_restart.py b/abs/mv-core/func/fe_restart.py new file mode 100644 index 0000000..a75b0c5 --- /dev/null +++ b/abs/mv-core/func/fe_restart.py @@ -0,0 +1,35 @@ +## +# other modules +import sub_process + +# our modules +import func_module + +# ================================= + +class re_restart(func_module.FuncModule): + + version = "0.0.1" + api_version = "0.0.1" + description = "Restart the frontend" + + def killX (self,flags="restart frontend"): + """ + Restart X + """ + flags.replace(";","") # prevent stupidity + cmd = sub_process.Popen("/sbin/sv %s " % flags,stdout=sub_process.PIPE,shell=True) + data = cmd.communicate()[0] + results = ['Restarted UI'] + return (cmd.returncode, results) + + def killmyth (self,flags="-9 mythfrontend"): + """ + kill the mythfrontend process server + """ + flags.replace(";","") # prevent stupidity + cmd = sub_process.Popen("/usr/bin/killall %s" % flags,stdout=sub_process.PIPE,shell=True) + data = cmd.communicate()[0] + results = ['killed mythfrontend'] + return (cmd.returncode, results) + diff --git a/abs/mv-core/func/power.py b/abs/mv-core/func/power.py index 297f464..668965a 100644 --- a/abs/mv-core/func/power.py +++ b/abs/mv-core/func/power.py @@ -16,9 +16,9 @@ class power(func_module.FuncModule): def reboot(self,flags="-q onecheck"): """ Reboot the server - """ + """ flags.replace(";","") # prevent stupidity - cmd = sub_process.Popen("/sbin/reboot") + cmd = sub_process.Popen("/sbin/reboot") data = cmd.communicate()[0] results = ['reboot'] return (cmd.returncode, results) @@ -26,9 +26,9 @@ class power(func_module.FuncModule): def poweroff (self,flags="-q onecheck"): """ Reboot the server - """ + """ flags.replace(";","") # prevent stupidity - cmd = sub_process.Popen("/sbin/poweroff") + cmd = sub_process.Popen("/sbin/poweroff") data = cmd.communicate()[0] results = ['off'] return (cmd.returncode, results) -- cgit v0.12