Linux system command pipes

I am trying to integrate TCL scripting code with  LabVIEW in a way I can send every TCL command separately and read back the results (under Linux platform).
From searching and reading information on web pages I found out that the best way to do so is by using the System command pipes .
I tried to do it but with no success I couldn't write or read from the pipe. I also didn't find any example how to implement the command pipes.
Does any one has any example (labView 2009 Linux) of opening a system command pipes reading  data from it and writing data to the pipe?

Hello
The examples are for named pipes and it works fine for passing data to the pipe and read the data from it.
But it cannot processes commands. In order to write Tcl commands I need pipe that is able to interpreter commands.
So I tried the system command pipes but it can only process bash commands like ls or pwd but I didn't find a way to open the tclsh and process commands in TCL.
I had another problem with concatenating commands got error 6.
I attached the file I created can you find what I am doing wrong?
Attachments:
Test command Pipe.vi ‏15 KB

Similar Messages

  • Does System command pipe VI bufferizes data?

    Hi,
    I have some questions about Pipe VIs on Linux:
    1)In my project I open a system command pipe vi that opens another
    program's shell. Then, using the write file descriptor, I write a
    series of commands in a loop. I could observe that only when I close
    the pipe those commands are really sent to the shell, OR when,
    aparently, something like a  "pipe vi buffer" overflows.
    2) In the same situation, I would like to use both the write and read
    file descriptors. The write pipe vi sends a command to the program's
    shell and them the read pipe vi reads the shell's results. I tried of
    many ways, including forcing serialization (open, then write, then
    read), but it didn't work at all. I could see that the write worked but
    the read can't read the results.
    The most interesting is if I use a ls -l in the open system vi, I can read the directory contents on the read vi...
    What's wrong? Is that a problem of LV or Linux? Or of the another program's shell?
    What can I do to make sure that a command is issued as it is writen to the pipe?
    Thanks in advance for the attention,

    Hi, ratem.
    I've just created a little code snippet (below), and I'd like you to tell me what happens when you run similar code on your machine. I run the code, read from the FIFO in a terminal, and I'm able to see the data I wrote before the pipe is closed. Does your behavior differ with this code?
    Message Edited by sarahk on 04-09-2006 12:36 PM
    Message Edited by sarahk on 04-09-2006 12:36 PM
    Sarah K.
    Search PME
    National Instruments
    Attachments:
    write with while.JPG ‏13 KB

  • System_Exec and Open System Command Pipe hangs in Solaris

    I'm using LV 7.1.1 on Solaris and I'm having major problems with the System Exec function in combination with Open System Command Pipe.
    1. The program has to run different stuff in parallel but the System Exec won't run in parallel with Open System Command Pipe. It immediately hangs and neither function ever returns. LabVIEW must be killed.
    2. After executing Open System Command Pipe, stopping the program and then executing a System Exec, that too hangs. The external script called by Open System Command Pipe is no longer running but obviously LV leaves something behind anyway. Close Pipe doesn't seem to clean up everything. Again, LabVIEW must be killed.
    3. Also, regardless of any System Exec call, the first time Open System Command Pipe and Read Pipe is executed it takes a very long time to get the result. After stopping the program and restarting it, it's much faster.
    Has anyone else experienced these problems?

    I'm having the same difficulties... tried many things, with no luck...

  • Backing up your Linux systems with the command line

    While there are many GUI-based backup and storage tools for Linux users, there are also a few command line-based tools. "Rsync" is one of these tools and, according to Linux.com, it stands for remote sync. With afull tutorial on how to use rsync, Linux.com walks you through how "one of the most used'tools' in the UNIX world [works]."
    Even though it's a simple tool, rsync has quite a few capabilities. You can use rsync "to sync files on two directories on the same PC, on two different systems on the same network, [and] .... on machines thousands of miles apart, over the Internet." In its guide, Linux.com explains each of these processes in detail. While the guide focuses on server backup, each and every command has its place on your personal workstation as well.
    What other tools do you use to back up your Linux systems?
    This topic first appeared in the Spiceworks Community

    try checking relevant environment variables like the CLASSPATH.... a major source of failures in Windows is when in the classpath there is a path containing SPACES.... also enabling some "debug" or "verbose" flag (not sure how to do it) would provide more insight...

  • Executing system commands like cd on Linux from Java Code

    Hi,
    I need to execute a few system commands (like cd, ls, tar, etc.,) on RedHat Linux 7.1 from Java code. Any ideas plz.
    best wishes,
    Issac

    Since this thread mentioned using the DOS START command
    from an exec(), I was wondering whether anyone else is
    seeing the odd behavior I am.
    Most of the examples showing how to read stdout and stderr
    while the process is running show simple loops that use
    getInputStream and getErrorStream and do read's until they
    get back -1. Most of these examples are insensitive to the
    state of the Process.waitFor that happens elsewhere and sort
    of rely on the -1 and the waitFor happening roughly together.
    Whenever I use this technique to launch an arbitrary DOS
    command (e.g. Runtime.exec("dir")), it works fine, and
    everything seems to terminate as expected.
    However, when my command is something like:
    Runtime.exec("cmd /c start my.bat")
    where I deliberately use the START command to fork off
    a different process, something odd happens.
    Those simple read loops get an initial burst of stdout/stderr
    bytes from the "start" part of the command. But then eventually,
    these loops do a "read" which blocks on those InputStreams. Now,
    even if my Process.waitFor returns (because the start returned
    immediately), those read loops stay blocked **until that script
    started by 'start' runs to completion**. It is like the child
    of the child is holding those streams open somehow.
    I found that by doing something like an InputStream.available() or
    a BufferedReader.ready( ) check before dropping into the read,
    and allowing the Process.waitFor completion to exit those read loops,
    them I get what I expect -- namely immediate return from the START,
    but apparently complete copies of stdout and stderr.
    Curiously, in the case where the reads block until the child process
    started by START terminates, they still don't get the child's/child's
    stdout and stderr. It is just a long duration thread block that
    yields no data.
    Can anyone explain what is happening to a
    Process.getInputStream( ).read()
    when the process immediately does a START and returns? Why would
    the read( ) stay blocked when the START finished launching a new child
    process?
    ... ron cain

  • Call a linux or a system command

    How can I call a system command from a javabean?
    I need to check if a link to store server is mounted in a linux system, and
    a I wrote an sh file to create the mount back.
    How can i call this sh file from a javabean?
    Thank's a lot

    Look at Runtime.getRuntime.
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html

  • Operating System commands for LINUX OS

    Hi,
    I am working on PI7.1 OS LINUX,i am clear about WINDOWS OS how to call and execute but not clear with Linux OS
    Just trying one POC kind of requirement with Operating System Commands
    first i started with simple requirement moving one file from one directiry to other directiory,but unfortunaltly i was not sucesfull.
    the help documentation also not clear ,could you please any one give some clear clue to hoW  to call shell script.
    i have created below script.
    #!/bin/sh                                                                                cd /Interface                                                                               
    cat BIA1.xml >> /interfaces/BIA2.xml  
    http://wiki.sdn.sap.com/wiki/display/XI/SAPXIFileAdapterOSCommandLine+Feature
    thanks,
    Raj

    hi its very simple,just copy .sh file in PI server and call just sh path.it will work

  • How do I create an FSDIAG file on Linux systems?

    QuestionHow do I create an FSDIAG file on Linux systems?
    AnswerTo create an FSDIAG file for the Linux Security product:
    Go to a working directory to which the fsdiag.tar.gz file will be created.
    Run the following command:
    # /opt/f-secure/fsav/bin/fsdiag
    Note: Any existing FSDIAG file will be overwritten.
    You will find the fsdiag.tar.gz file on the current working directory. Attach this file to your support request.
    To create an FSDIAG file for the Internet Gatekeeper (IGK) product:
    Create the diagnostic information file (diag.tar.gz) in the product install directory by running the following command:
    - IGK (Japanese 4.x): # cd /home/virusgw; make diag
    - IGK (English 4.x or English/Japanese 5.x): # cd /opt/f-secure/fsigk; make diag
    Note: Any existing FSDIAG file will be overwritten.
    Attach this file to your support request.
    Note that you can also create the diagnostic file by using the Web UI.

    An .srt is simply a plain text file with sequence numbers, time markers, and captions. You can use any text editor to make one. Follow the pattern:
    1
    00:00:00,500 --> 00:00:04,500
    So it was with my formal education
    as well.
    2
    00:00:04,600 --> 00:00:08,250
    Each weekday, while my father worked
    on his Sunday sermon...
    3
    00:00:08,300 --> 00:00:10,000
    I attended the school
    of the Reverend Maclean.
    The first number (e.g., 00:00:00,500) in each pair indicates when the caption starts. The second number (e.g., 00:00:04,500) in each pair indicates when the caption stops.
    If you're going to be captioning many videos, consider an application that merges a text editor and video preview window. Jubler (http://www.jubler.org/) is one.

  • Calling the system commands in Java

    Hi All,
    How to call the system commands in java other than using
    exec() function.For eg, in my linux machine i have used p.exec("exit") to exit from a cshell to the prompt but it is not working.Is there any other solution for this one. Pls. do provide a solution for this.It is quite Urgent.
    Thanks,
    m.ananthu

    Why not SEARCH THE F*ING FORUMS!! This has been answered SO MANY TIMES

  • How to? multiline label containing exact system command output

    Background info: I'm triggering a system command to display memory utilization. As you know, the "free" linux command displays many lines of text one after the other. It is similar to the mem command used in Window$.
    I want to have a label displaying the command output as it is: multiple lines. Just like you see it in the console. I want to mirror whatever comes up on console after executing free from java.
    Using html tags won't work out for me in this particular situation. It just doesn't do the trick. Still displays the LAST line of command output with or without html tags.
    any ideas? it doesn't have to be a label. It can be anything as long as it works.
    Again, as it is, it just displays the last line of the command output
    //events will trigger every second
    Timer t = new Timer(1000, new ActionListener(){
          public void actionPerformed(ActionEvent event)
    //determine memory utilization.
            String cmd = "free -m";
        try {
         String line;
         Process p = Runtime.getRuntime().exec(cmd);
         BufferedReader input =
           new BufferedReader
             (new InputStreamReader(p.getInputStream()));
         while ((line = input.readLine()) != null) {
           label.setText(line);
         input.close();
        catch (Exception err) {
         err.printStackTrace();
        t.start();

    got it. thanks.
    String cmdMem = "free -m -t -o" ;
          try {
            String lineMem ;
            String outputMem = "" ;
            Process procMem = Runtime.getRuntime ().exec ( cmdMem ) ;
            BufferedReader input =
                new BufferedReader
                ( new InputStreamReader ( procMem.getInputStream () ) ) ;
            while ( ( lineMem = input.readLine () ) != null ) {
              outputMem = ( lineMem + "\n" ) ;
              jTextAreaSystemResourcesOutput.append ( outputMem ) ;
            input.close () ;
          catch ( Exception err ) {
            err.printStackTrace () ;
          }

  • How to use Operating System Commands while using define in sqlplus

    How to use Operating System Commands while using define in sqlplus . The Host OS is Linux
    define report_name=PROD_${host date "+%b"}.html
    The above is not working.
    The output should be 
    define report_name=PROD_JAN.html
    Regards,
    DB

    of course I was talking nonsense: the problem here is the mixing of bind variables and DEFINE variables.
    With the following changes the script should work (the conditions for begin_interval_time are perhaps not what you want):
    variable snap1 number
    variable snap2 number
    variable rptname varchar2(20)
    begin
    SELECT min(snap_id) into :snap1 FROM dba_hist_snapshot WHERE CAST(begin_interval_time AS DATE) >= SYSDATE-1;
    SELECT max(snap_id) into :snap2 FROM dba_hist_snapshot WHERE CAST(begin_interval_time AS DATE) >= SYSDATE-1;
    end;
    col file_name_value new_value report_name noprint
    select 'PROD_'|| to_char(sysdate,'MON') || '_' ||  to_char(sysdate,'DD') file_name_value  from dual;
    define  report_type  = 'html'
    define num_days=2
    define begin_snap=:snap1
    define end_snap=:snap2
    @@?/rdbms/admin/awrrpt.sql

  • System command from within PL/SQL on server ?

    Hi
    I know its a bit weird thought of executing an NT system command from within PL/SQL on server (UNIX).
    Has anyone done something (silly me!) like it or knows any work-around to try something like it?
    Thanks in advance.
    Regards
    Pravesh

    Can you be more specific?
    Generally to run system commands you utilize DBMS_PIPE to communicate with a listener on the platform that you're accessing. That listener picks up the pipe request and might either:
    1. spawn a process to run the command
    2. fork a process to run the command
    3. run the command within its own application.
    It sounds complex, but if review the DBMS_PIPE documentation and it's not too difficult -- presuming you know a language like C.
    I believe there are other features in 8.1.5 and higher versions that enable you to run stored programs or COM objects...
    Bill

  • Execute system command line instructions

    Hi,
    suppose that my java program has to execute a system command line instrction(let's say dir/p for dos or ls * f or linux)
    how can we execute these system command line instructions programmatically from within a java program?
    thanks indeed for helping...

    i want to thank jfbriere for the usefull link he/she provides me with. 1- He
    2- You're welcome :-)

  • Unix SYSTEM command

    Hello,
    We are migrating from informix to Oracle. In our Informix Stored Procedure we
    were able to call Unix Shell Script by executing a 'SYSTEM' command, such as:
    CREATE PROCEDURE magazine(flag1, flag2)
    SYSTEM '/pics2/informix/mag.sh' || flag1 || flag2;
    END PROCEDURE;
    How can I write this in PL/SQL? Is there a simillar command for 'SYSTEM' in PL/SQL?
    Thanks

    While sending the message, you would use PACK_MESSAGE and SEND_MESSAGE:
    This could be your PL/SQL procedure.
    DBMS_PIPE.PACK_MESSAGE('<Your Message>');
    return_code := DBMS_PIPE.SEND_MESSAGE
    (pipename => '<Any unique legal identifier as pipe-name>'
    ,timeout => (1*60)) ;
    if (return_code <> 0)
    then
    Raise_Application_Error(-20100, 'Error sending message.') ;
    end if ;
    While reading the message, you would use RECEIVE_MESSAGE and UNPACK_MESSAGE:
    This could be with-in your target PL/SQL code, or Java function or a C/Pro*C program.
    return_code := DBMS_PIPE.RECEIVE_MESSAGE
    (pipename => '<pipe-name used when calling SEND_MESSAGE>'
    ,timeout => 10);
    IF return_code = 0
    THEN
    DBMS_PIPE.UNPACK_MESSAGE(<variable to receive the message>);
    ELSE
    No message received, wait for a while and try again.
    DBMS_LOCK.SLEEP(30) ;
    END IF ;
    Let me know if you need more info on this.
    Kamal,
    Would you mind sharing some example code for using DBMS_PIPE to execute OS commands with in PL/SQL?
    Thx,
    SriDHAR

  • Solaris 7 and System Commander

    I am trying to add Solaris 7 to the 2nd ide drive on a Linux/Win98 box using System Commander but it will not let me install on the second drive. How do I do this??

    hi nodiseos
    I am using a dell dimension 4100 machine. I already have win2000,win98 in the primary drive(10GB) using using 'System Commander' as boot manager to select the OS( to boot into).
    I installed slave disk(30GB-IBM)and have been trying with all the possibilities to get the solaris(version-6/00)installed on the slave disk. I used "Solaris 8 Software 1/2" CD. I was not able to get solaris installed on second(slave) disk evenwitth the single user mode.
    Looking for ur help badly if u have got any result.
    -Nalla ([email protected])

Maybe you are looking for