Execute command of Linux

Dear All,
I want to execute command below but I don't know the step. Could anyone help me on this. I try to enter using root password & type this command but no output appeared. Please advice;
1. File permission of 1) /etc/passwd and 2) /etc/shadow file by executing either one of the command below:
/usr/bin/cat/ls -l /etc/passwd
or cat ls -l /etc/passwd
/usr/bin/cat/ls -l /etc/shadow
or cat ls -l /etc/shadow
2. Password configuration setting of Linux by excuting the all 3 commands
below:
a) /usr/bin/ls -l /var/log/ >var_log.txt
/bin/cat/etc/pam.d/login > etc_pamd_login.txt
b) /bin/cat/etc/login.defs > etc_logindefs.txt
/bin/cat/etc/pam.d/system-auth > etc_pamd_systemauth.txt
c) /bin/cat/etc/pam.d/system-auth > etc_pamd_systemauth.txt
/bin/ls-l/etc/security/opasswd > etc_security_opasswd.txt

The no ip rcmd rsh-enable command does not prohibit a local user of the router from executing a command on other routers and UNIX hosts on the network using rsh. The no form of this command only disables remote access to rsh on the router.
For more information on rsh please click following link:
http://www.cisco.com/en/US/products/sw/iosswrel/ps1831/products_command_reference_chapter09186a00800d9833.html#1018286

Similar Messages

  • Executing windows batch commands from linux

    Hi,
    Kindly shed some light on executing the MSwindows batch commands from linux machine.
    Thanks
    RKA

    hi RKA
    What about using a virtual windows machine ? Or use a DOSemu (DOS Emulator) is a program that lets you run many of your favorite DOS applications under Linux.
    Why do you need to execute MSwindows batch commands ?
    Please explain.
    Edited by: Hub on Nov 12, 2008 1:56 PM

  • Grep Command in Linux

    Hi all,
    I having problem getting the output of grep command in Linux (Red Hat 9.0).
    At the same time, I am able to get the output of cat command.
    Using the output of cat command, I am writing it to a text file and then in another process using grep I am extracting particular line from the text file.
    To get the Process Output I am using a code from http://hacks.oreilly.com/pub/h/1092#thread.
    Below is my code.
    public void getUSBInfo() {     
           try{
                  String catCommand =  "cat /proc/bus/usb/devices";
                  System.out.println("catCommand is : "+catCommand);
                  Process p = Runtime.getRuntime().exec(catCommand);
                  usbInfoBuffer = new StringBuffer("");
                  InputStream inStream = p.getInputStream();
                  new InputStreamHandler( usbInfoBuffer, inStream ); 
                                  // InputStreamHandler is the class used to read the console output.
                  StringBuffer errBuffer = new StringBuffer();
                  InputStream errStream = p.getErrorStream();
                  new InputStreamHandler( errBuffer , errStream );
                  p.waitFor();
                  catCommandOutput = usbInfoBuffer.toString();
                  System.out.println("USB Info : " +catCommandOutput);
                  String fileCat ="/EthicsPoint/usbInfo.txt";
                  File catCommandOutputFile =  new File(fileCat);
                  boolean filesuccess = catCommandOutputFile.createNewFile();
                  setContents(catCommandOutputFile,catCommandOutput);
                  extractUSBInfo();
                  }catch(Exception e) {
                 JOptionPane.showMessageDialog(null," Exception occured executing Native Method..catCommand.."                                         ,epname,JOptionPane.ERROR_MESSAGE);                                    System.out.println("File Exception No 6" +e);
    public void extractUSBInfo() {
         try {
              String filename = " /EthicsPoint/usbInfo.txt";
              String grepCommand = "grep \"P:\\|S:\""+filename ;
               //String[] grepCommand = new String[]{"grep", "\"P:\\|S:\"", "/EthicsPoint/usbInfo.txt"};
              Process p = Runtime.getRuntime().exec(grepCommand);
              usbExtractedInfoBuffer = new StringBuffer("");
              InputStream inStream = p.getInputStream();
              new InputStreamHandler( usbExtractedInfoBuffer, inStream );
              StringBuffer errBuffer = new StringBuffer();
              InputStream errStream = p.getErrorStream();
              new InputStreamHandler( errBuffer , errStream );
              p.waitFor();
              String Output = usbExtractedInfoBuffer.toString();
              System.out.println("grepCommand is    : " +grepCommand);
              System.out.println("Searched USB Info : " +Output);
          }catch(Exception e) {
         JOptionPane.showMessageDialog(null," Exception occured executing Native Method..grepCommand..."                               ,epname,JOptionPane.ERROR_MESSAGE);                                    System.out.println("File Exception No 7" +e);
          }I am not getting any IOException. The output of System.out.println("Searched USB Info : " +Output); is blank.
    If I try shell> grep "P:\|S:" /EthicsPoint/usbInfo.txt, I get the desired output.
    What could be the reason ? While using cat command I am getting the output , but grep command is
    returning blank. I even tried String array[] for exec() command, but still get blank.
    Where and what I am doing wrong ?
    Thanks in advance.
    Regards,
    Jay.

    Hi asjf,
    Thanks a lot... The problem is finally solved.
    String exeCommand = "grep P:\\|S: "+filename; I removed the quotes and it worked. But if I
    remove backslash for the pipe symbol nothing happens..as I get return value of 1.
    Output after removing quotes :
    exeCommand is : grep P:\|S:  /EthicsPoint/usbInfo.txt
    Exit Value is : 0
    USB Info : P:  Vendor=0000 ProdID=0000 Rev= 0.00
    S:  Product=USB OHCI Root Hub
    S:  SerialNumber=ce84b000
    P:  Vendor=0000 ProdID=0000 Rev= 0.00
    S:  Product=USB OHCI Root Hub
    S:  SerialNumber=ce849000But I have noticed another problem. If I execute the aplication number of times, eventhough
    the exit value is 0, USB Info : is blank. This happens sometimes. Sometimes I get the correct output.
    What could be the reason ?
    Thanks to you and all who have replied to my queries....Thanks a lot.....Really appreciate the time and effort.
    Regards,
    Jay.

  • Execute commands in multiple Cisco devices simultaneously

    Hi all:
    We have a big network and every time we need to execute commands in switches and routers, it takes a lot going one by one to do it. Is there any way, ie using special software, or Linux, scripts, whatever that can be used to execute same commands in all devices at the same time?
    Thanks in advance
    W.

    in CiscoWorks LMS there is the  RME NetConfig task which can do this for you. You can download an eval copy of LMS here (90 day eval for 100 devices)
    http://www.cisco.com/go/nmsevals or
    https://cisco.mediuscorp.com/market/networkers/listSubCat.se.work?TRGT=8&/nxt/rcrs/=1126
    to get the solaris version
    but there is also the the "Cisco Enhanced Device Interface" which perhaps could be a solituon for you:
    http://www.cisco.com/en/US/products/ps6456/tsd_products_support_series_home.html
    not forget to mention the Kiwi Cat Tools:
    http://www.kiwisyslog.com/kiwi-cattools-overview/

  • Unable to execute command adprmkey in upgrading 11i to 12.1.1

    Hello Team Leaders:
    I am in the process of upgrading EBS 11.5.10.2 to Release 12.1.1. I have imported the database, Layed down the apps and have started applying patches. While running adpatch I have encountered:
    java.lang.Exception: ERROR: Unable to execute command: adprmkey /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/fnd/jar/fndlist.jar.tmp
    at oracle.apps.ad.jri.util.JarSignerOptions.getOptions(JarSignerOptions.java:50)
    at oracle.apps.ad.jri.util.JarSignUtils.signJarWithJarsigner(JarSignUtils.java:132)
    at oracle.apps.ad.jri.adjmx.mergeAndExtract(adjmx.java:1313)
    at oracle.apps.ad.jri.adjmx.main(adjmx.java:970)
    Done Analyzing fndlist.jar : Fri Oct 26 2012 16:06:42
    ERROR: The following jars failed to get generated properly.
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/fnd/jar/fndforms.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/fnd/jar/fndewt.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/fnd/jar/fndewtpv.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/fnd/jar/fndaol.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/fnd/jar/wfapi.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/fnd/jar/fndaroraclnt.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/fnd/jar/fndmail.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/fnd/jar/fndactiv.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/fnd/jar/fndformsi18n.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/fnd/jar/mapclient.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/fnd/jar/fndxmlparserv2.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/cs/jar/cs.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/az/jar/azwizard.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/jtf/jar/jtfgrid.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/cct/jar/cctbasic.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/msd/jar/msejar.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/wps/jar/wpsgantt.jar
    /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/fnd/jar/fndlist.jar
    I then tried relinking on jar manually:
    cd /u02/applfint/apps/apps_st/comn/java/classes/oracle/apps/fnd/jar
    ll fndaroraclnt.jar
    -rw-r--r-- 1 applfint dba 1135766 Apr 1 2009 fndaroraclnt.jar
    adrelink.sh force=y "fndaroraclnt.jar "
    Errors:
    adrelink: error: Product library for product "fndaroraclnt.jar" not found.
    "fndaroraclnt.jar" might not be listed correctly in your OFT1_ofintest.env file,
    you may be missing some files for product "fndaroraclnt.jar",
    or "fndaroraclnt.jar" could be an invalid product.
    adrelink will not try to link product "fndaroraclnt.jar".
    Continuing work on other products...
    adrelink is exiting with status 1
    What is my problem?
    Mathias

    Hi Hussein,
    Following command in (11864081 12.1.3 Java.lang.Exception: Unable To Find Or Read Parameter File /d01/oracle/R12DEV/apps/a [ID 1479911.1]), I have executed:
    adrelink.sh force=y "ad adprmkey"
    And the output errors are:
    /usr/lib/gcc/x86_64-redhat-linux/4.4.4/32/libgcc_s.so: undefined reference to `__stack_chk_fail@GLIBC_2.4'
    collect2: ld returned 1 exit status
    make: *** [u02/applfint/apps/apps_st/appl/ad/12.0.0/bin/adprmkey] Error 1
    Done with link of ad executable 'adprmkey' on Sun Oct 28 01:59:50 EDT 2012
    Relink of module "adprmkey" failed.
    See error messages above (also recorded in log file) for possible
    reasons for the failure. Also, please check that the Unix userid
    running adrelink has read, write, and execute permissions
    on the directory /u02/applfint/apps/apps_st/appl/ad/12.0.0/bin,
    and that there is sufficient space remaining on the disk partition
    containing your Oracle Applications installation.
    I checked and do have permissions on /u02/applfint/apps/apps_st/appl/ad/12.0.0/bin:
    drwxr-xr-x 2 applfint dba 4096 Oct 28 02:10 bin
    Browsing around the system I noticed:
    1) three broken links in /usr/lib/gcc/x86_64-redhat-linux/4.4.4/32:
    libgfortran.so -> ../../../../libgfortran.so.3.0.0
    libmudflapth.a -> ../../../i686-redhat-linux/4.4.4/libmudflapth.a
    libmudflap.a -> ../../../i686-redhat-linux/4.4.4/libmudflap.a
    libgomp.so -> ../../../../libgomp.so.1.0.0
    2) Following MOS note 11864081 12.1.3 Java.lang.Exception. Check this out:
    adrelink.sh force=y "ad adprmkey"
    Failed with:
    usr/lib/gcc/x86_64-redhat-linux/4.4.4/32/libgcc_s.so: undefined reference to `__stack_chk_fail@GLIBC_2.4'
    collect2: ld returned 1 exit status
    make: *** [u02/applfint/apps/apps_st/appl/ad/12.0.0/bin/adprmkey] Error 1
    Done with link of ad executable 'adprmkey' on Fri Oct 26 18:14:16 EDT 2012
    Relink of module "adprmkey" failed.
    3) My OS :
    uname -a
    Linux ofintest.corp.phillips.com 2.6.32-100.28.5.el6.x86_64 #1 SMP Wed Feb 2 18:40:23 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
    4) rpm -q glibc
    glibc-2.12-1.80.el6_3.5.x86_64
    glibc-2.12-1.80.el6_3.5.i686
    5) gcc -v
    Using built-in specs.
    Target: x86_64-redhat-linux
    Configured with: ../configure prefix=/usr mandir=/usr/share/man infodir=/usr/share/info with-bugurl=http://bugzilla.redhat.com/bugzilla enable-bootstrap enable-shared enable-threads=posix enable-checking=release with-system-zlib enable-__cxa_atexit disable-libunwind-exceptions enable-gnu-unique-object enable-languages=c,c++,objc,obj-c++,java,fortran,ada enable-java-awt=gtk disable-dssi with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre enable-libgcj-multifile enable-java-maintainer-mode with-ecj-jar=/usr/share/java/eclipse-ecj.jar disable-libjava-multilib with-ppl with-cloog with-tune=generic with-arch_32=i686 --build=x86_64-redhat-linux
    Thread model: posix
    gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC)
    6) g++ --version
    g++ (GCC) 4.4.4 20100726 (Red Hat 4.4.4-13)
    Copyright (C) 2010 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    7) ls -al /usr/bin | grep gcc
    lrwxrwxrwx. 1 root root 3 Oct 17 12:28 cc -> gcc
    -rwxr-xr-x 2 root root 268088 Dec 1 2010 gcc
    -rwxr-xr-x 2 root root 268088 Dec 1 2010 x86_64-redhat-linux-gcc
    8) rpm -qf /usr/bin/x86_64-redhat-linux-gcc
    gcc-4.4.4-13.el6.x86_64
    I hope this information helps in troubleshooting this issue for us.
    Thanks
    Mathias
    Thanks,

  • Execution timed out error when running opcagt command on linux server with agent 11.12.009 installed

    Hi,
    Can anyone help me in the below issue.
    we have a Linux server with agent version 11.12.009 installed on it. when I try running opcragt command on it through are management server it gives the output that all agent components are running.
    but when I check the agent status or version through opcagt command on it it gives below error:
    ERROR:   (depl-86) Unable to execute command 'opcagt' on node
                       (depl-176) Message returned from host           
    (xpl-117) Timeout occurred while waiting for data.
    Below are the error lines that I got from system.txt file of the server:
    0: ERR: Fri Dec 19 09:09:38 2014: ovconfd (3708/140429034952480): (conf-180) Could not create messenger for configuration server 'ovconfd' and register its methods with the messenger object.
    1: ERR: Fri Dec 19 09:09:38 2014: ovconfd (3708/140429034952480): (xpl-89) write(11)[012C5430] failed.
    2: ERR: Fri Dec 19 09:09:38 2014: ovconfd (3708/140429034952480): (RTL-28) No space left on device
    Could anyone please let me know what can be the issue in this.
    Thanks,
    Akansha

    ORA-00600: internal error code, arguments: [kzxcInitLoadLocal-7], [942],
    [ORA-00942: table or view does not exist
    ORA-01403: no data found
    ORA-06512: at "SYS.DBMS_NETWORK_ACL_ADMIN", line 252
    ORA-06512: at line 36
    ORA-01403: no data foundWhat does this query return?
    SQL>  SELECT HOST, ACL
    FROM DBA_NETWORK_ACLS;Please see (Redefining a Network Access Control List Fails with ORA-1403 [ID 854083.1]).
    Thanks,
    Hussein

  • Can't execute command - drive didn't come online; check configuration/hardw

    I have a Scalar i500 on a Linux host attached via fiber channel. I have everything working accept automounting the drive. I can't seem to get it working.
    I can use the web interface of the i500 and then put a tape in the drive. I can then mount the drive from Secure Backup and run a back up just fine. Yet, I can't run a backup without a tape mounted. If I choose "Load Volume (Drive).... I get the error "can't execute command - drive didn't come online; check configuration/hardware"
    I can inventory the library and do just about anything except automount the drives. I run a verify and the configuration comes back clean with no errors. I have tried using the SCSI params in the obl0 and obt0 ,and obt2 with no success. I have tried using the raw /dev/sg paths with no success. Same error.
    This is a upgraded installation from 10.1 to 10.3. I have tried doing a clean install with same issue. I have restored the installation and then run a upgrade with the same issue.
    I am stuck. Please help :)
    Thanks

    It appears you may have the DTE's swapped.
    Swap the DTE #'s assigned to the drive device objects and try again. This could happen during an upgrade if you reassigned scsi settings and the obt0 and obt1 devices swapped scsi settings from when they ran things last.

  • Execute command fails

    Hi All,
    I am facing a weird problem with the Runtime.exec command. I am trying to run a simple Linux command from within Java. But i noticed that commands gets stuck if i run it on a file larger than 2K! If I run the same command on the linux shell it does not fail and it does not get stuck. it ends within less than a second.
    Since I do not want my program to get stuck, I used some code someone published (cannot remember who... but thanks :)) which kills the process after some timeout time. But I still failed to understand why the command gets stuck. Its definitely has to do with file size, since if i take the same file and remove some lines from it, the program does not get stuck. Again running the same command on linux shell does not get stuck and finishes very fast.
    Here's the simplified version of my code,
    import java.io.BufferedInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.Timer;
    import java.util.TimerTask;
    import java.util.concurrent.TimeoutException;
    import java.io.DataInputStream;
    * Execute command from the Runtime. This class will make sure the external application will not hung the application by specifying
    * a timeout in which the application must return. If it does not an InterruptedException will be thrown
    class JPT_RuntimeExecutor
         private long timeout = Long.MAX_VALUE;
          * Default constructor - Timeout set to Long.MAX_VALUE
         public JPT_RuntimeExecutor()
         // Do nothing
          * Constructor
          * @param timeout Set the timeout for the external application to run
         public JPT_RuntimeExecutor(long timeout)
              this.timeout = timeout;
          Execute a Runtime process
         * @param command - The command to execute
         * @param env - Environment variables to put in the Runtime process
         * @return The output from the process
         * @throws IOException
         * @throws TimeoutException - Process timed out and did not return in the specified amount of time
         public InputStream execute(String command, String[] env) throws IOException, TimeoutException
              Process p = Runtime.getRuntime().exec(command, env);
              boolean status = true;
              // Set a timer to interrupt the process if it does not return within the timeout period
              Timer timer = new Timer();
              timer.schedule(new InterruptScheduler(Thread.currentThread()), this.timeout);
              try
                   p.waitFor();
              } catch (InterruptedException e)
                   // Stop the process from running
                   p.destroy();
                   status = false;
                   throw new TimeoutException(command + "did not return after "+this.timeout+" milliseconds");
              finally
                   // Stop the timer
                   timer.cancel();          
              // Get the output from the external application
              StringBuilder buffer = new StringBuilder();
              BufferedInputStream br = new BufferedInputStream(p.getInputStream());
              while (br.available() != 0)
                   buffer.append((char) br.read());
              String res = buffer.toString().trim();
              if ( status )
                   return p.getInputStream();
              return null;
         private class InterruptScheduler extends TimerTask
              Thread target = null;
              public InterruptScheduler(Thread target)
                   this.target = target;
              public void run()
                   target.interrupt();
      public static void main(String[] args)
          try
              String cmd = "dot -Tplain " + args[0];
              System.out.println( " cmd = " + cmd );
                 JPT_RuntimeExecutor m_process = new JPT_RuntimeExecutor(5000*3);
                 DataInputStream tmpStreamReader = null;
                 try
                      tmpStreamReader =  new DataInputStream( m_process.execute(cmd, null ));
                 } catch (IOException e)
                      e.printStackTrace();
                      return;
                 } catch (TimeoutException e)
                      e.printStackTrace();
                      return ;
                  System.out.println( "END");
          catch ( Exception e )
                      e.printStackTrace();
                      return ;
            return;
    }Here's a sample of the input file I give which gets stuck ( in case you want to run it :))
    digraph koko{
    label="PT=result\nFILE=BottomWindowPathSearch#1Transitive49211"
    27 [label="START\nAC=4363", color=blue]
    29 [label="END\nAC=4363", color=blue]
    69 [label="UOP\nAC=4363", color=black]
    71 [label="ALLOCATE\nAC=3780", color=black]
    73 [label="EXECUTE\nAC=2995", color=black]
    75 [label="RETIRE\nAC=3286", color=black]
    860 [label="alstall_jeclearing\nAC=56", color=black]
    869 [label="JECLEAR\nAC=56", color=black]
    69 -> 29 [label="PRB=0.221\nAC=963", color=blue]
    71 -> 29 [label="PRB=0.053\nAC=202", color=blue]
    73 -> 29 [label="PRB=0.029\nAC=87", color=blue]
    75 -> 29 [label="PRB=0.963\nAC=3111", color=blue]
    73 -> 75 [label="PRB=0.96\nDUR=10/124/1620\nAC=2876", color=black]
    71 -> 73 [label="PRB=0.778\nDUR=8/91/1628\nAC=2983", color=black]
    75 -> 71 [label="PRB=0.031\nDUR=2/300/1414\nAC=99", color=black]
    71 -> 75 [label="PRB=0.088\nDUR=10/59/1246\nAC=339", color=black]
    860 -> 71 [label="PRB=0.732\nDUR=24/30/36\nAC=41", color=black]
    71 -> 860 [label="PRB=0.01\nDUR=4/87/1100\nAC=40", color=black]
    71 -> 71 [label="PRB=0.055\nDUR=4/109/1044\nREP=1.02\nAC=205*1.02", color=black]
    73 -> 860 [label="PRB=0.002\nDUR=16/20/22\nAC=5", color=black]
    75 -> 75 [label="PRB=0.004\nDUR=4/189/920\nAC=14", color=black]
    73 -> 71 [label="PRB=0.006\nDUR=4/144/708\nAC=18", color=black]
    73 -> 73 [label="PRB=0.003\nDUR=2/196/568\nAC=9", color=black]
    75 -> 73 [label="PRB=0.001\nDUR=6/12/18\nAC=2", color=black]
    75 -> 860 [label="PRB=0.002\nDUR=2/46/170\nAC=6", color=black]
    860 -> 75 [label="PRB=0.018\nDUR=2\nAC=1", color=black]
    869 -> 75 [label="PRB=1\nDUR=18/83/982\nAC=56", color=black]
    71 -> 869 [label="PRB=0.015\nDUR=20/109/1628\nAC=56", color=black]
    860 -> 73 [label="PRB=0.018\nDUR=24\nAC=1", color=black]
    69 -> 71 [label="PRB=0.778\nDUR=2/117/1502\nAC=3395", color=black]
    27 -> 69 [label="PRB=0.996\nDUR=430/20932/38130\nAC=4345", color=blue]
    860 -> 69 [label="PRB=0.232\nDUR=10/19/30\nAC=13", color=black]
    69 -> 860 [label="PRB=0.001\nDUR=26/50/82\nAC=5", color=black]
    71 -> 69 [label="PRB=0.001\nDUR=2/7/14\nAC=5", color=black]
    27 -> 71 [label="PRB=0.004\nDUR=584/13675/37096\nAC=18", color=blue]
    If you remove about 8 lines it will not get stuck!
    Hope someone can help me figure out why this is happenning
    thanks
    eman

    Thanks ... somehow I missed this issue..
    The article you sent was really helpful :) recommended for every one
    Here's the code if anyone ever needs it... it runs with timeout so that the program does not get stuck
    Enjoy
    import java.io.BufferedInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.Timer;
    import java.util.TimerTask;
    import java.util.concurrent.TimeoutException;
    import java.io.DataInputStream;
    import java.io.*;
    * Execute command from the Runtime. This class will make sure the external application will not hung the application by specifying
    * a timeout in which the application must return. If it does not an InterruptedException will be thrown
    class JPT_RuntimeExecutor
         private long timeout = Long.MAX_VALUE;
          * Default constructor - Timeout set to Long.MAX_VALUE
         public JPT_RuntimeExecutor()
         // Do nothing
          * Constructor
          * @param timeout Set the timeout for the external application to run
         public JPT_RuntimeExecutor(long timeout)
              this.timeout = timeout*3;
          Execute a Runtime process
         * @param command - The command to execute
         * @param env - Environment variables to put in the Runtime process
         * @return The output from the process
         * @throws IOException
         * @throws TimeoutException - Process timed out and did not return in the specified amount of time
         public InputStream execute(String command, String[] env , String outfileName) throws IOException, TimeoutException
              Process proc = Runtime.getRuntime().exec(command, env);
              boolean status = true;
              // Set a timer to interrupt the process if it does not return within the timeout period
              Timer timer = new Timer();
              timer.schedule(new InterruptScheduler(Thread.currentThread()), this.timeout);
        FileOutputStream fos = new FileOutputStream( outfileName );
        // any error message?
        StreamGobbler errorGobbler = new
        StreamGobbler(proc.getErrorStream(), "ERROR");           
        // any output?
        StreamGobbler outputGobbler = new
        StreamGobbler(proc.getInputStream(), "OUTPUT", fos);
        // kick them off
        errorGobbler.start();
        outputGobbler.start();
              try
          int exitVal = proc.waitFor();
          System.out.println("ExitValue: " + exitVal);
          fos.flush();
          fos.close();       
              } catch (InterruptedException e)
                   // Stop the process from running
                   proc.destroy();
                   status = false;
                   throw new TimeoutException(command + "did not return after "+this.timeout+" milliseconds");
              finally
                   // Stop the timer
                   timer.cancel();          
           BufferedReader in = null;
              try
                in = new BufferedReader(new FileReader( outfileName ));
              catch ( Exception e)
                System.out.println( " Could not open file" + outfileName + "!!!");
              System.out.println( "Start reading output " );
              System.out.println( " ============================== " );
              String input = null ;
              try
                 while ( (input= in.readLine() ) != null )
                    System.out.println( input );
              catch ( Exception e)
                System.out.println( " Could not read line !!!");
              return null;
         class StreamGobbler extends Thread
        InputStream is;
        String type;
        OutputStream os;
        StreamGobbler(InputStream is, String type)
            this(is, type, null);
        StreamGobbler(InputStream is, String type, OutputStream redirect)
            this.is = is;
            this.type = type;
            this.os = redirect;
        public void run()
            try
                PrintWriter pw = null;
                if (os != null)
                    pw = new PrintWriter(os);
                InputStreamReader isr = new InputStreamReader(is);
                BufferedReader br = new BufferedReader(isr);
                String line=null;
                while ( (line = br.readLine()) != null)
                    if (pw != null)
                        pw.println(line);
                    else
                      System.out.println(type + ">" + line);   
                if (pw != null)
                    pw.flush();
            } catch (IOException ioe)
                ioe.printStackTrace(); 
         private class InterruptScheduler extends TimerTask
              Thread target = null;
              public InterruptScheduler(Thread target)
                   this.target = target;
              public void run()
                   target.interrupt();
      public static void main(String[] args)
          try
              String cmd = "dot -Tplain " + args[0];
              System.out.println( " cmd = " + cmd );
                 JPT_RuntimeExecutor m_process = new JPT_RuntimeExecutor(5000);
                 DataInputStream tmpStreamReader = null;
                 try
                      tmpStreamReader =  new DataInputStream( m_process.execute(cmd, null , args[1] ));
                 } catch (IOException e)
                      e.printStackTrace();
                      return;
                 } catch (TimeoutException e)
                      e.printStackTrace();
                      return ;
                     System.out.println( "END");
          catch ( Exception e )
                      e.printStackTrace();
                      return ;
            return;
    }

  • HOST COMMAND ON LINUX

    hi all
    i'm trying to execute a host command from the oracle form on linux operating system. all commands are executed under the linux user OPS$THIN . i want to change this user. i tried a shell script to change the user i.e: switch user (SU) and it did not work. i checked the script privileges and it's 777.
    plz help
    thanx

    Hi Francois
    Yes that user has all the rights. To prove that I have the following code
    declare
    in_file text_io.file_type;
    linebuf varchar2(200);
    infile1 text_io.file_type;
    begin
    /*host ('/bin/sh /u01/apps/nucleus/a.sh',screen);
    if NOT Form_Success then
    message('failed ');pause;
    else
    message('Form_Success');pause;
    end if;*/
    in_file := Text_IO.Fopen('/u01/apps/a.txt', 'r');
    infile1 := Text_IO.Fopen('/u01/apps/a1.txt', 'w');
    Text_IO.Get_Line(in_file,linebuf);     
    text_io.fclose(in_file);
    text_io.put_line(infile1,linebuf);
    text_io.fclose(infile1);
    End;
    Now a1.txt created.
    Thanks
    Muthu

  • How to schedule jar command on linux in /etc/crontab

    hello ,
    i am facing a problem in scheduling java -jar myjarfilename.jar in crontab in linux .i have tried by giving the command directly in the /etc/crontab entry and running it as a script from the crontab but in vain.please give me some ideas how to schedule this jar command on linux in /etc/crontab.
    thanx

    Stuff the above accept for the STARs read about them;
    This a REAL BASIC senerio. ASSUMING you are paulb the user
    To add a cron job it is BEST to use "crontab"
    1) MAKE SURE YOU CAN USE CRONTAB
    check "/etc/cron.d/cron.deny " does not exist and it does not have your username in it
    If it does, you will have to remove your name somehow or just delete the file.
    2) MAKE YOUR SCRIPT
    using your fav editor like "joe" or "pico" or err "vi" make a textfile called "home/paulb/hiscript.sh"
    This script is just saying hi in sh and then printing a date when it said hi in the dumbhi.log
    --------start of hiscript.sh----------------
    #!/bin/sh
    echo "hi at";date > /home/paulb/dumhi.log;
    --------end of hiscript.sh----------------3) MAKE SCRIPT EXECUTABLE
    run the command
    "chmod +x /home/paulb/hiscript.sh"4) MAKE A CRONTAB FILE FOR YOURSELF
    using your fav editor like "joe" or "pico" or err "vi" make a textfile called "home/paulb/paulb.ct"
    This is EVERY 1 min run that script. See u need to know the commands
    -----start of paulb.ct-------------------------
    1  *  *  *  *   home/paulb/hiscript.sh
    -----end of paulb.ct-------------------------5) ADD THE CRON JOB
    run the command
    "crontab /home/paulb/paulb.ct"All done

  • Diadem runtime error while executing command "SchemeMeasStar"

    Hello:
    I used DIAdem9.0 and DAQCard6062E to acquire 16 channel data. I collected 65536 data for every channel. Whereas After the data acquisition stopped, an Error Message would poped up, but the data is still stored in data portal. the Error is like follows:
    -Error- DIAdem
    Runtime Error While Executing Command "SchemeMeasStar"
    Error Type: UNKNOWN
    Error Address:00001720
    Module Name:GFSBase.Dll
    Would you like to give me some suggestions?
    thanks very much
    jing

    Dear MarcusP:
    Thank you very much.
    your solution really works. The attached is the detailed information of the problem. Would you like to tell me more about the prolem and how to solve the problem thoroughly.
    Thank you very much.
    yours
    Jing
    Attachments:
    DIAdem_Error.doc ‏305 KB

  • Error while executing "" command Error type ACCESS VIOLATION Error Address: 0006898E Module name:gfsdesk.DLL

    Hi All,
    I'm using diadem from .net Program. While on the run I'm getting the following error.
    Error While executing "" Command
    Error type ACCESS VIOLATION
    Error Address: 0006898E
    Module name:gfsdesk.DLL
    Anyone have any idea why this is happening?
    regards,
    Swaroop

    Hi Swaroop,
    It would be helpful to better understand what your code really does. The information that you called DIAdem from your enviroenment is not yet sufficient to understand what the problem might be.
    Andreas

  • Tr command in Linux

    Hi All,
    I searched internet for the usage of tr command, honestly it is very powerfull when process flat files,
    take text replacement for example
    cat file1.txt | tr "abc" "xyz"
    the output will be that 'a' change to 'X', 'b' to 'Y', 'c' to 'Z'
    but does it support function that can replace "abc" to "xyz", not change them individually?
    Please advise which kind of option should I use for tr or any other command in Linux?
    thanks
    Henry

    How about find and replace with SED, e.g.:
    $ sed -i 's/orig_text/new_text/g' /home/oracle/test.txt
    sed edits "-i" /home/oracle/test.txt in place and replaces "orig_text" with "new_text"
    You can find many examples and tutorials about SED in google e.g.
    http://tldp.org/LDP/Bash-Beginners-Guide/html/chap_05.html

  • Just installed Lion and the Magic TrackPad and I am having a problem with one click commands.  I have to hit the pad fairly hard with one finger to get it to accept the command.  Is this normal, is there another way that I am suppose to execute commands?

    Just installed Lion and the Magic TrackPad and I am having a problem with one click commands.  I have to hit the pad fairly hard with one finger to get it to accept the command.  Is this normal, is there another way that I am suppose to execute commands?

    No you just need to turn on Tap to Click. Go into System Preferences - Trackpad and click the Point to Click tab and select the first box which will say Tap to Click and you should be in business.

  • How to execute command(program) from external file in Oracle SQL developer

    Hi,
    Does anyone know, Oracle SQL developer version 1.0.0.14.67 got any function that can execute command from an external file?
    Example, i have 100 insert SQL inside a text file,
    and i want to use Oracle SQL developer to execute it. How do i read from my text file? Thanks a lots.

    If you're new to Oracle, do yourself and us a favour: read some tutorials and manuals. What sqldev's worth, better download the latest version (1.1.2), lots of fixes and enhancements...
    Now for the big popper: to run an external file: @file
    Best of luck,
    K.

Maybe you are looking for