Results 1 to 5 of 5

Thread: Running an Executable

  1. #1

    Question Running an Executable

    hi,

    What would be good way to run an executable? For example I want to run ping command or lftp command. And it'll be great if I could pipe the output and display in Lianja - well, if possible non-blocking

    Thanks,
    Murali

  2. #2
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,842
    Hi Murali,

    From the Linux desktop you could use ! and output to a file, then handle the file e.g.

    Code:
    !ping -c 5 192.168.3.3 > /home/yvonne/ping.txt
    type /home/yvonne/ping.txt
    Is that the sort of thing you had in mind?

    Regards,

    Yvonne

  3. #3
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,186
    Hi Murali,

    if you want to use plain ftp, that is built into lianja. Check out NetworkRequest and ShowDocument on the wiki.

    If you need additional ftp features, the Python FTP library module can be accessed from any of the 4 languages.

    For ping, you can use a python script, such as https://pypi.python.org/pypi/python-ping/ called from a .py file, and then call it from any of the 4 dev languages in Lianja. There are similar things available in PHP, which you can find by searching on ping php.

    hth,

    Hank

    Quote Originally Posted by murali_mepath View Post
    hi,

    What would be good way to run an executable? For example I want to run ping command or lftp command. And it'll be great if I could pipe the output and display in Lianja - well, if possible non-blocking

    Thanks,
    Murali

  4. #4
    Hi Hank,

    Thanks for the suggestion. The FTP capability built into Lianja is fantastic and comes handy for most of the common FTP Tasks. But I am using lftp because the current situation demands an FTP solution that is highly configurable. I can get everything to work fine but "piping" the output in a "nice way" proved a little tricky. To be more specific, it wasn't even the piping thingy, it was the non-blocking status display within the confines of Lianja that was proving to be a bit difficult. Finally I managed by redirecting the output to a file, and then reading the file into the webview gadget. In addition I used "inotify" so that I don't poll the file contents continously but rather reload the file into the webview only when it changes.

    Btw thanks for the pointer to ShowDocument. Even though I had used it before I just learnt something new related to Lianja.showDocument( "command" ) from the wiki page.

    'Its also worth pointing out that the "command" that can be given as the parameter to showDocument() can also be specified in WebView sections as the href="command" in HTML5 hyperlinks.' Now that's useful and nice! ",) I strictly believe in not having to write code when there is no need to and this feature is right in that direction

    Cheers,
    Murali

  5. #5
    Hi Yvonne,

    Thanks for the suggestion. I did something similar and it works fine now I am reloading the output file into the webview as and when it changes. I am using inotify to detect the changes to the file as the command executes. Moreover it doesn't block anything now and I have the added advantage of nicely formating the result before displaying it, rather than display the somewhat raw output from the execution of certain commands.

    Cheers,
    Murali

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us