I've been working on this for quite a while and can't seem to get it, must
be missing something.

What I'd like to do is run the command:

"/bin/su -c /home/mailman/bin/newlist $list_name $owner $passwd1 | grep : |
grep -v file:"

I also need to send a \r (CR) after $passwd1 before the first grep and I
need to capture the output of it and append all that to a sendmail aliases
file. It would be nice to be able to remove the list as well it involves
running: "/bin/su -c /home/mailman/bin/rmlist -a $list_name" and then
removing the aliases (for that list) from the sendmail file. PERL snippits
that accomplish this are included below.

Thanks for your help! --Ben

The PERL code (for adding) is below:
sub createNewList {
 if ($_[2] eq "") {
  error($text{erArgs});
 }
 $listName = $_[0];
 $adminEmail = $_[1];
 $listPassword = $_[2];

 #this command is a cludge, if they change the output it may
 #mess the whole thing up
 $commandLine = "su -c '".$config{newlist_exec}." $listName $adminEmail

$listPassword' ".$config{exec_as_user}."| grep : | grep -v file:|";

 #this will only add the newlist to mailman, we still need to
 #add the aliases
 open(RESULT, $commandLine ) || return 0;
 print $text{txtAlias}."<br>\n";
 while (<RESULT>) {
  $line = $_;
  $line =~ s/\"/\"/;
  $line =~ s/\"\n/\"/;
  $line =~ s/\n//;
  system("echo \'$line\' >> $config{aliases_file} ");
  print "$line<br>";

 }
 close(RESULT);
 system("su -c '$config{newaliases_command}' ");
# system("$config{newaliases_command}");

}

The PERL code (for removing) is below:
sub deleteList {
 if ($_[0] eq "") {
  error($text{erListName});
 }
 $listName = $_[0];
 $delArchives = $_[1];
 if ($delArchives) {
  $cmdLine = "su -c '$config{rmlist_exec} -a $listName'

$config{exec_as_user}";
 } else {
  $cmdLine = "su -c '$config{rmlist_exec} $listName'

$config{exec_as_user}";
 }
 open(OUTPUT, "$cmdLine |" )||error($text{erExecution});
 while (<OUTPUT>) {
  print "$_<br>";
 }
 close(OUTPUT);
 $cmdLine = "cat $config{aliases_file} |grep -v $listName:| grep -v

$listName-owner:|grep -v $listName-request:|grep -v $listName-admin:>

$config{aliases_file}";
 #we need to backup our old alias file
 system("cp $config{aliases_file} $config{aliases_file}.backup");
 system($cmdLine);
 system("su -c '$config{newaliases_command}' $config{exec_as_user}");
# system("$config{newaliases_command}");
 print $text{txtBackup}."$config{aliases_file}.backup";

}



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to