hi sandip
this is a nice solution but my problem is that i dont have cron access or
even shell with non-root. i only have ftp :(. so how do i initalise code?
manish
On Tue, 22 Jan 2002 12:48:47
Sandip Bhattacharya wrote:
>
>Or, how about another hack? This would be an ugly polling based solution which you
>might dislike.
>
>1. Lets suppose you have a flag - which could be a zero sized file with a
>pre-determined name.
>
>2.Then, you
>either have a daemontools/bash script with a minimum resolution of 1 second
>or a cronjob with a minimum resolution of 1 minute.
>
>3. Your web script removes or creates the file, based on whether you want to start
>the service or stop it.
>
>4. When the background process, on one of its polling iteration,
>finds that the flag is not present, but service is up, it stops it,
>and vice versa.
>
>Pros:
> - easy to create.
> - Extremely secure. No running of setuid scripts, root web processes etc.
>
>Cons:
> - not very elegant, but works.
> - poll based. Not probably good for infrequently used services.
>
>The design pattern is similar to what djbdns uses.
>
>- Sandip
>
>On Tue, Jan 22, 2002 at 12:18:24PM +0530, Rajat Bhatia spoke out thus:
>> Hi,
>> Would it suffice, if in the program we want to run in the background, we do a
>fork, and then terminate the parent process, while the child process starts the
>services as required?
>>
>> Regards,
>> Rajat
>>
>> Manish K Arya wrote:
>>
>> > hi
>> > thanks for quick reply.
>> > actully have made a program that read mysql database in cartain time intervals
>and takes action according to cases.now i want to have a web based panel to start and
>stop that service.
>> >
>> > On Tue, 22 Jan 2002 11:33:43
>> > Kapil Sethi wrote:
>> > >I think that is an interesting situation.
>> > >
>> > >The job of HTTP server is to load a file and transfer the contents to the
>> > >client. after the html page is served the server closes the connection. In
>> > >case of server parsed documents like cgi / php /asp etc. scripts the server
>> > >waits for the appropriate engine to process the request and hand over the
>> > >document in HTML format to it. The server then forwards this document to the
>> > >client. when you try to execute a program in background using CGI the server
>> > >is still waiting for the child program to terminate. In effect waiting for
>> > >the complete output which it will forward to client. Thus the server process
>> > >waits indefinitely for the child process to terminate. Also as the
>> > >background process does not terminate, every request to the cgi script will
>> > >create one more instance to the same program in memory overloading your
>> > >system.
>> > >
>> > >So, I think this is a bad idea to create background processes using a web
>> > >server.
>> > >
>> > >Can we know what exactly is the motive, we may be able to suggest some
>> > >better way.
>> > >
>> > >Kapil Sethi
>> > >System Administrator
>> > >BharatConnect Ltd.
>> > >Ph: 011-6430987
>> > >----- Original Message -----
>> > >From: "Manish K Arya" <[EMAIL PROTECTED]>
>> > >To: "general linux" <[EMAIL PROTECTED]>; "linux programmers"
>> > ><[EMAIL PROTECTED]>
>> > >Sent: Tuesday, January 22, 2002 11:03 AM
>> > >Subject: [ilugd]: (No Subject)
>> > >
>> > >
>> > >> hi
>> > >> i was trying to run a program in background thru cgi and php.
>> > >> i have written a shell script to intialize the C program that i want to
>> > >run in background
>> > >> like
>> > >>
>> > >> #/bin/bash
>> > >> program&
>> > >>
>> > >> and now i try to run this shell script thru C cgi using system() in C cgi
>> > >and exec() in php.
>> > >> program gets started in background properly.but the problem is that web
>> > >browser gets busy(loading icon glows).and statements after exec()/system()
>> > >are not executed.i dont know why it is happening.
>> > >>
>> > >> pls suggest
>> > >>
>> > >> ---
>> > >> Manish Kumar Arya
>> > >> --------------------------------------------
>> > >> While universe
>> > >> {
>> > >> Object emerges from zero, tends to infinity and finally end in zero.
>> > >> }
>> > >> --------------------------------------------
>> > >>
>> > >>
>> > >>
>> > >>
>> > >>
>> > >>
>> > >> ================================================
>> > >> To subscribe, send email to [EMAIL PROTECTED] with subscribe in
>> > >subject header
>> > >> To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in
>> > >subject header
>> > >> Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org
>> > >> =================================================
>> > >>
>> > >
>> > >
>> >
>> > ================================================
>> > To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject
>header
>> > To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject
>header
>> > Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org
>> > =================================================
>>
>> -- - Popi Classification -------------------------------------------------------
>> Classification applies if checked...
>> [ ] General Business Information
>> [ ] Motorola Internal Use only
>> [ ] Motorola Confidential Proprietary
>>
>> --- A Nice Quote --------------------------------------------------------------
>> "When the only tool you have is a hammer, you tend to treat everything as if it
>were a nail." -- Abraham Maslow
>> -- Contact Me -----------------------------------------------------------------
>> Rajat Bhatia
>> [EMAIL PROTECTED]
>> Tel: +91-124-6307212 Ext 1350
>> +91-124-6303212 EPABX Operator
>> Fax : +91-124-6306679
>>
>>
>
>--
>Sandip Bhattacharya
>sandipb @ bigfoot.com
>http://www.sandipb.net
>----------------------------
>
> ================================================
>To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject header
>To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject
>header
>Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org
> =================================================
>
>
================================================
To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject header
To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject header
Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org
=================================================