Results 1 to 4 of 4
hi guys
I am working on a menu...
and the menu has some options like check status for services (gmonitor group) or stop - start - restart those same services ...
- 04-09-2010 #1Just Joined!
- Join Date
- Dec 2006
- Posts
- 21
allow or not script
hi guys
I am working on a menu...
and the menu has some options like check status for services (gmonitor group) or stop - start - restart those same services (gadmin group)
as you see there are 2 main groups gmonitor for monitoring and gadmin for restart - stop - start services
so checking command groups
basically I want to read the output from groups command and atfer thatCode:#groups root root : root bin daemon sys adm disk wheel ivmgr httpd gadmin #groups cgonza cgonza : cgonza testing gmonitor
if group gadmin is found allow the user to restart services and if gmonitor group is found deny access to restart services
the point is I don't know how to get that groupvar
thanks a lotCode:if [ "$groupvar" == "gadmin" ] then restart services options else echo "... you are not allowed to ..."
- 04-10-2010 #2
uservar=`whoami`
groupvar=`groups $uservar|sed s/.*://`
if [[ $groupvar == "gadmin* ]]
then
echo ...you are allowed to..."
else
echo "... you are not allowed to ..."
fi
Should do what you want.
- 04-10-2010 #3Just Joined!
- Join Date
- Dec 2006
- Posts
- 21
thanks a lot
- 04-10-2010 #4
I have a typo in there, I think: The quote before gadmin should be a * like the one following it. Sorry.


Reply With Quote