From: <ta...@us...> - 2013-12-13 08:21:26
|
Revision: 8770 http://gfarm.svn.sourceforge.net/gfarm/?rev=8770&view=rev Author: tatebe Date: 2013-12-13 08:21:20 +0000 (Fri, 13 Dec 2013) Log Message: ----------- gfsudo - execute a command in gfarmroot privilege Modified Paths: -------------- gfarm_v2/branches/2.5/gftool/Makefile Added Paths: ----------- gfarm_v2/branches/2.5/gftool/gfsudo/ gfarm_v2/branches/2.5/gftool/gfsudo/Makefile gfarm_v2/branches/2.5/gftool/gfsudo/gfsudo Modified: gfarm_v2/branches/2.5/gftool/Makefile =================================================================== --- gfarm_v2/branches/2.5/gftool/Makefile 2013-12-13 08:15:45 UTC (rev 8769) +++ gfarm_v2/branches/2.5/gftool/Makefile 2013-12-13 08:21:20 UTC (rev 8770) @@ -39,6 +39,7 @@ gfspoolpath \ gfstat \ gfstatus \ + gfsudo \ gftest \ gfuser \ gfusage \ Added: gfarm_v2/branches/2.5/gftool/gfsudo/Makefile =================================================================== --- gfarm_v2/branches/2.5/gftool/gfsudo/Makefile (rev 0) +++ gfarm_v2/branches/2.5/gftool/gfsudo/Makefile 2013-12-13 08:21:20 UTC (rev 8770) @@ -0,0 +1,9 @@ +top_builddir = ../.. +top_srcdir = $(top_builddir) +srcdir = . + +include $(top_srcdir)/makes/var.mk + +SCRIPTS = $(srcdir)/gfsudo + +include $(top_srcdir)/makes/script.mk Added: gfarm_v2/branches/2.5/gftool/gfsudo/gfsudo =================================================================== --- gfarm_v2/branches/2.5/gftool/gfsudo/gfsudo (rev 0) +++ gfarm_v2/branches/2.5/gftool/gfsudo/gfsudo 2013-12-13 08:21:20 UTC (rev 8770) @@ -0,0 +1,16 @@ +#!/bin/sh +# execute command in gfarmroot privilege +# usage: gfsudo cmd arg ... + +ABORT() +{ + echo $* >&2 + exit 1 +} + +user=`gfwhoami 2>/dev/null` +[ X"$user" = X ] && ABORT "Who are you?" + +gfgroup -ma gfarmroot $user || ABORT "You are not gfarmadm or already gfarmroot" +trap 'gfgroup -mr gfarmroot $user' 0 1 2 15 +$* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |