[Xitami] RE: Stopping and restarting (or resetting) Xitamiwithperl

Francis Turner francis.turner at gmail.com
Wed Jan 4 23:29:35 CET 2006


For those that care here is the script - obviously change 'username',
'password' to the right values.

Normally you would do the VHOST creation foirst then call this script.
I don't see why you can't do this during the CGI call although I admit
I haven't tested it to see if that works. Leaving this script to run
as a dedicated service is left as an exercise to the student but some
hints can be found in my realplayer controller code
http://www.di2.nu/software/muzack.htm

#!/usr/bin/perl

# Created on 04-Jan-2006 22:17:28

use LWP::UserAgent;
my $ua = LWP::UserAgent->new;

my $req = HTTP::Request->new(GET => 'http://localhost/admin');
$req->authorization_basic('username', 'password');
my $response = $ua->request($req);

if ($response->is_success) {
     $_ = $response->as_string;  # or whatever
     die "no admin in $_" unless m!FORM METHOD=POST ACTION="/admin([^"]+)"!s;
     print "got first round - $1\nsecond... ";
     $req = HTTP::Request->new(POST => 'http://localhost/admin'.$1);
     $req->authorization_basic('username', 'password');
     $req->content_type('application/x-www-form-urlencoded');
     $req->content('jsaction=~A47.0');
     $response = $ua->request($req);
     print $response->status_line;
}
else {
     die $response->status_line;
}

On 1/4/06, Pieter Hintjens <ph at imatix.com> wrote:
> > problem two - which is where I'm proposing the perl script is for when
> > you want to prod Yitami to reload its config because you have
> > (programatically) added some more VHOSTS or similar. In this case you
> > know Xitami is actually alive so you don't want to kill it in the
> > middle of doing something
>
> Xitami will automatically reload its config file when it can, however
> it cannot reload its vhost config dynamically, and for this you need
> to stop/restart it.  Using the WBA interface is equivalent to doing a
> stop/start.
>
> Yes, to do this remotely, you could use the /admin interface and
> 'click' on the restart button.
>
> -Pieter Hintjens
>
>
> --
> Xitami Users Mailing List -- For Xitami support
> To unsubscribe: http://lists.xitami.org/mailman/listinfo/xitami
>


--
http://www.di2.nu/blog.htm
Faber's Fourth Law:
  Necessity is the mother of strange bedfellows.



More information about the Xitami mailing list