Hallo Marco, I know this is maybe a bit overdone, but why not simply download your quoted URL via e.g. lynx (Linux/UNIX) or wget (Windows) ? I use this technique for some workarounds of this kind. As you did not state how you authenticate to the server, I do not know whether this will work out for you, but it is worth a try.
Best regards Stefan -------- Original Message -------- Subject: [dev] Call a GenericAgent-Job from within another Perl-Script (06-Feb-2007 18:44) From: Marco Friebe <[EMAIL PROTECTED]> To: stefan > Hello, > > I want to call a GenericAgent-Job from within another Perl-Script. I want > do do some work in the otrs database (Oracle) and then call that Agent-Job > subsequently. > > Like it is done for manual job invocation using URL "http://localhost/otrs/ > index.pl?Action=AdminGenericAgent&Subaction=RunNow&Profile=Test" but called > from commandline (Cron). > > > Since I'm a very novize regarding Perl I would be grateful if someone could > point me in the right direction. Maybe this problem has already been solved. > > > > > Snip***** > > use Kernel::Modules::AdminGenericAgent; (presupposed I'm in /opt/otrs) > > %ParamList = ("Subaction" => "RunNow", "Profile" => "Test"); > Kernel::Modules::AdminGenericAgent::Run(%ParamList); > > Snap***** > > > I saw there is a constructor which needs to be called at first, but no idea > how to do this correctly. > > > And here an extract of AdminGenericAgent.pm > > > Snip***** > > sub new { > my $Type = shift; > my %Param = @_; > > # allocate new hash for object > my $Self = {}; > bless ($Self, $Type); > > foreach (keys %Param) { > $Self->{$_} = $Param{$_}; > } > > # check needed Opjects > foreach (qw(ParamObject DBObject TicketObject LayoutObject LogObject > ConfigObject)) { > if (!$Self->{$_}) { > $Self->{LayoutObject}->FatalError(Message => "Got no $_!"); > } > } > > $Self->{PriorityObject} = Kernel::System::Priority->new(%Param); > $Self->{StateObject} = Kernel::System::State->new(%Param); > $Self->{LockObject} = Kernel::System::Lock->new(%Param); > $Self->{GenericAgentObject} = Kernel::System::GenericAgent->new(%Param); > > > return $Self; > } > # -- > sub Run { > my $Self = shift; > my %Param = @_; > my $Output; > # get confid data > $Self->{StartHit} = $Self->{ParamObject}->GetParam(Param => 'StartHit') > || 1; > $Self->{SearchLimit} = $Self->{ConfigObject}->Get('SearchLimit') || 500; > > $Self->{SortBy} = $Self->{ParamObject}->GetParam(Param => 'SortBy') || ' > Age'; > $Self->{Order} = $Self->{ParamObject}->GetParam(Param => 'Order') || ' > Down'; > $Self->{Profile} = $Self->{ParamObject}->GetParam(Param => 'Profile') || > ''; > $Self->{SaveProfile} = 1; > $Self->{TakeLastSearch} = $Self->{ParamObject}->GetParam(Param => ' > TakeLastSearch') || ''; > $Self->{SelectTemplate} = $Self->{ParamObject}->GetParam(Param => ' > SelectTemplate') || ''; > $Self->{EraseTemplate} = $Self->{ParamObject}->GetParam(Param => ' > EraseTemplate') || ''; > # get db job data > my %DBParam = $Self->{GenericAgentObject}->JobGet(Name => $Self->{ > Profile}) if ($Self->{Profile}); > > # run job now > if ($Self->{Subaction} eq 'RunNow' && %DBParam) { > $Self->{GenericAgentObject}->JobRun( > Job => $Self->{Profile}, > UserID => 1, > ); > # redirect > return $Self->{LayoutObject}->Redirect( > OP => "Action=$Self->{Action}", > ); > } > > # create new job > if ($Self->{Subaction} eq 'Add' && $Self->{Profile}) { > # insert new profile params > $Self->{GenericAgentObject}->JobAdd( > Name => $Self->{Profile}, > Data => { > ScheduleLastRun => '', > }, > ); > # redirect > return $Self->{LayoutObject}->Redirect( > OP => "Action=$Self->{Action}&Subaction=LoadProfile&Profile=$ > Self->{Profile}", > ); > } > > > Snap***** > > > Thanks a lot. > > Greetings > > Marco > > > _______________________________________________ > OTRS mailing list: dev - Webpage: http://otrs.org/ > Archive: http://lists.otrs.org/pipermail/dev > To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/dev _______________________________________________ OTRS mailing list: dev - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/dev To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/dev
