Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Trigger perl scrip remotely using http

by ikegami (Patriarch)
on Mar 25, 2009 at 20:19 UTC ( [id://753242]=note: print w/replies, xml ) Need Help??


in reply to Trigger perl scrip remotely using http

#!/usr/bin/perl use strict; use warnings; $SIG{CHLD} = 'IGNORE'; if (fork()) { print "Content-type: text/html\n\n"; print "ok"; exit; } close(STDIN); close(STDOUT); close(STDERR); #start doing lots of things that are time consuming blah1(); blah2(); ...

You can add error checking to fork and direct STDERR to a log file, but you get the idea.

A better solution would provide feedback to the user. This article shows how it can be done.

Replies are listed 'Best First'.
Re^2: Trigger perl scrip remotely using http
by saberworks (Curate) on Mar 25, 2009 at 21:21 UTC
    Just to clarify, this suggestion is to do a fork on the server so the parent process (the one you call over http) starts a child and then returns content to your client script immediately. The parent will then exit while the child happily continues forever.
Re^2: Trigger perl scrip remotely using http
by rethaew (Sexton) on Mar 25, 2009 at 23:20 UTC
    Yes, works perfectly. Thank you.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://753242]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-19 19:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found