Hi, [EMAIL PROTECTED] <[EMAIL PROTECTED]> asked: > I'm actually building a web interface to a news group server (INN). > One of the feature is to allow a few users to create and > delete newsgroups from the web.
Hopefully only for your local news hierarchy ;-) > Normally, from the shell, I would perform the following operations to > create or remove a newsgroup (I will setuid the ctlinnd because ctlinnd > needs to be executed as the "news" user): That is not the best possible solution. The best would doubtless be to set up a small tcp service that will run these commands on your behalf as the news user. The next best alternative would be to use sudo to allow your web server user to run the required commands as the proper user. > /usr/local/news/bin/ctlinnd pause "modification of active file" > /usr/local/news/bin/ctlinnd rmgroup/newgroup name_of_the_newsgroup > /usr/local/news/bin/ctlinnd reload active "reload active file" > /usr/local/news/bin/ctlinnd go "modification of active file" How long will those commands take to execute? Bear in mind that users as a species are dumb and that sh*t will happen, so you might want to consider that a user could hit the stop button while these jobs are still running. The web server will kill your CGI program and that will certainly also kill a spawned ctlinnd. > If the server successfully performed the command, ctlinnd > will exit with a status of zero and print the reply on > standard input. [...] > It's not clear to me how I could retrieve the status code. > I would also like to know whether the way I use system() is > right or if there is a better way to do what I'm tryining to do. I would say that system seems to be suited best to the task at hand. Not only does it allow you to read the status code on completion, but you can also check for crashes of the called program. from "perldoc -f system": You can check all the failure possibilities by inspecting $? like this: $exit_value = $? >> 8; $signal_num = $? & 127; $dumped_core = $? & 128; [...] > #!/usr/bin/perl > > use strict; > use warnings; > > use CGI; # one I find quite useful for CGI development use CGI::Carp qw(fatalsToBrowser); HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]