--- loncom/Attic/lcuseradd 2006/08/25 21:25:22 1.39 +++ loncom/Attic/lcuseradd 2007/03/28 20:43:37 1.41 @@ -6,7 +6,7 @@ # with adding a user with filesystem privileges (e.g. author) # # -# $Id: lcuseradd,v 1.39 2006/08/25 21:25:22 albertel Exp $ +# $Id: lcuseradd,v 1.41 2007/03/28 20:43:37 albertel Exp $ ### ############################################################################### @@ -348,9 +348,16 @@ system('/bin/chown','-R',"$safeusername: # system('/bin/chown',"$safeusername:www","/home/$safeusername"); # Now adust top level... # system('/bin/chown','-R',"$safeusername:www","/home/$safeusername/public_html"); # And web dir. # ---------------------------------------------------- Gracefull Apache Restart +my $pidfile; if (-e '/var/run/httpd.pid') { + $pidfile = '/var/run/httpd.pid'; +} elsif (-e '/var/run/httpd2.pid') { #Apache 2 on SuSE 10.1 and SLES10 + $pidfile = '/var/run/httpd2.pid'; +} + +if ($pidfile) { print "lcuseradd Apache restart\n" unless $noprint; - open(PID,'/var/run/httpd.pid'); + open(PID,"<$pidfile"); my $pid=; close(PID); $pid=~ /(\D+)/; @@ -372,6 +379,11 @@ sub enable_root_capability { } else { # root capability is already enabled } + if ($wwwid == $>) { + print("Failed to become root\n") unless $noprint; + } else { + print("Became root\n") unless $noprint; + } return $>; }