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 grp.pl
#!/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 ~>
|