Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Nov 2004
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    outputting a linux command using ajax

    Hello


    I never used ajax . Anyone can explain me how to output , for example the result of this linux command

    ps aux | grep "httpd"

    on the browser using Ajax (instead to refresh the page using javascript for example).

    The ajax page should update for example each 2 seconds the result of above linux command . Any help please ? Is it hard to realize (I know only php) , any guideline please ?


    Thank you!
    Graziano

  • #2
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    I don't know a lot of Linux commands...what does that do? Open the process manager and look for all processes with httpd? Do you have this working now with page refreshes and want to convert it over?
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #3
    New Coder
    Join Date
    Nov 2004
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts
    exactly ! It returns this

    nobody 5219 0.0 1.8 227748 18100 ? S 11:40 0:01 /usr/local/apache/bin/httpd -DSSL
    nobody 25655 0.2 1.9 227688 19816 ? S 12:43 0:01 /usr/local/apache/bin/httpd -DSSL
    nobody 25656 0.4 1.8 227756 18728 ? S 12:43 0:02 /usr/local/apache/bin/httpd -DSSL
    nobody 25657 0.3 1.9 227608 19656 ? S 12:43 0:01 /usr/local/apache/bin/httpd -DSSL
    nobody 25659 0.3 1.8 227708 19056 ? S 12:43 0:01 /usr/local/apache/bin/httpd -DSSL
    nobody 25660 0.4 2.3 228196 23812 ? S 12:43 0:02 /usr/local/apache/bin/httpd -DSSL
    nobody 25661 0.2 1.7 227644 17948 ? S 12:43 0:01 /usr/local/apache/bin/httpd -DSSL
    nobody 25662 0.1 1.8 227640 18520 ? S 12:43 0:00 /usr/local/apache/bin/httpd -DSSL
    nobody 26137 0.3 1.9 227632 19380 ? S 12:45 0:01 /usr/local/apache/bin/httpd -DSSL
    nobody 26198 0.5 2.1 227708 21088 ? S 12:45 0:02 /usr/local/apache/bin/httpd -DSSL
    Last edited by graziano; 07-27-2007 at 05:58 PM.

  • #4
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    Okay cool. If you were saying "exactly" meaning you already have this operation being done with javascript (and page refreshes), you'd basically set up your javascript to do the ajax call using the setInterval() with the onload event of the body tag. You can use something like AjaxUpdater to retrieve the information from your source (i.e. your .php file or whatever).

    Here's a link to show you how to use the Ajax Updater. (You'll have to have the prototype library. You can get it from here.)
    http://www.ajaxtutorial.net/index.ph...totype-part-2/

    If you were asking how to peform the actual linux command from the browser, then that is out of my realm of expertise.

    Is this the same Graziano (formerly) of JB.org?
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #5
    New Coder
    Join Date
    Nov 2004
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you!

    Is this the same Graziano (formerly) of JB.org?

    no ..

  • #6
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    Okay cool, I thought you were a DJ. That tutorial is pretty straight forward and will hopefully get you on your way.
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •