Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^2: Want to Create Unix group using perl script

by abhi.nitk2003 (Initiate)
on Mar 18, 2010 at 08:21 UTC ( #829345=note: print w/replies, xml ) Need Help??

in reply to Re: Want to Create Unix group using perl script
in thread Want to Create Unix group using perl script

Hi, I got it. but I want my script just take group id (not group name) and if it exists then run chgrp,chmod g+s command as root.Basically my script is running under my cronjob but to run chmod , chgrp I need to become "root" first. so how should I do that
abhishek~/perl ~> cat #!/usr/bin/perl $in=<STDIN>; ($name, $passwd, $gid, $members) = getgrgid($in); print "group name: $name \t group id: $gid \n"; if ( $in == $gid ) { print "Success\n"; #how to become "root" here.. exec ("chgrp -R $gid /home/abhishek/cpp") || die "could not do chgrp $ +!"; } else { print "Group id does not exists, you need to give the existing group i +d \n"; } abhishek~/perl ~>

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://829345]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2016-10-24 04:21 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (302 votes). Check out past polls.