Executing "at" command of UNIX through JSP

Friends,
1. "at" command in UNIX execute Unix command at a scheduled time. 2. For each user there will be a table maintained internally which can be accessed by "at" with "-l" argument.
3. A mail will be sent to the owner with the output of the commands as a message.
I tried to run the "at" command of Unix in JSP, which gets succesfully executed in Oracle 10g App Server container (Installed in Solaris machine). I have tested the successful execution of command with the log file. But I haven't got any mail for the output. If anyone had any idea, please help me.
The code I have wtitten is
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(new String[] {"sh","-c","at 2115 Dec 7 < /export/home/usr1/abc.sh"});
InputStream stderr = proc.getErrorStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);
String line = null;
logger.info("<ERROR>");
while ( (line = br.readLine()) != null)
logger.info(line);
logger.info("</ERROR>");
int exitVal = proc.waitFor();
logger.info("Process exitValue: " + exitVal);
My doubts are:
1. Who is the owner of the output of "at"command, which gets executed under Oracle 10g App Server container?
2. If no one is the owner, then where will the output of "at" command will go?
3. Is there any other way to execute "at" command of UNIX in java program? If so, then please help me.
Thanks in advance.
regards
Nandha Kumar.M

I would imagine the process call out will be under the guise of the process owner of the OC4J instance which executing the call.
Have you seen anything different.
cheers
-steve-

Similar Messages

  • Executing amadmin command in Unix box.

    I tried to execute following command on Unix machine:
    ./amadmin -u uid=amAdmin,ou=People,o=ievesp.net -v -w "password"
    -s /etc/opt/SUNWam/config/xml/amUser.xml
    I am getting following error message:
    Info 112: Entering ldapAuthenticate method!
    Success 0: No Exceptions! LDAP Authentication success!
    Info 113: Calling SSO method!
    Error 9: Operation failed: null
    Please tell me why I am getting this Error?
    Where can I find log files?
    Can anyone please help me on this?

    Following is the error message that is recorded at LDAP logs:
    [27/Jun/2006:06:31:01 -0400] conn=145220 op=-1 msgId=-1 - fd=83 slot=83 LDAP connection from <<ip address>> to <<ip address>>
    [27/Jun/2006:06:31:01 -0400] conn=145220 op=0 msgId=1 - BIND dn="uid=amAdmin,ou=People,o=seccap.net" method=128 version=3
    [27/Jun/2006:06:31:01 -0400] conn=145220 op=0 msgId=1 - RESULT err=0 tag=97 nentries=0 etime=0
    dn="uid=amadmin,ou=people,o=seccap.net"
    [27/Jun/2006:06:31:01 -0400] conn=145220 op=1 msgId=2 - UNBIND
    [27/Jun/2006:06:31:01 -0400] conn=145220 op=1 msgId=-1 - closing - U1
    [27/Jun/2006:06:31:01 -0400] conn=145220 op=-1 msgId=-1 - closed.
    [27/Jun/2006:06:31:03 -0400] conn=145221 op=-1 msgId=-1 - fd=83 slot=83 LDAP connection from <<ip address>> to <<ip address>>
    [27/Jun/2006:06:31:03 -0400] conn=145222 op=-1 msgId=-1 - fd=88 slot=88 LDAP connection from <<ip address>> to <<ip address>>
    [27/Jun/2006:06:31:03 -0400] conn=145222 op=0 msgId=3 - BIND dn="" method=128 version=3
    [27/Jun/2006:06:31:03 -0400] conn=145222 op=0 msgId=3 - RESULT err=0 tag=97 nentries=0 etime=0 dn=""
    [27/Jun/2006:06:31:04 -0400] conn=145221 op=-1 msgId=-1 - closing - B1
    [27/Jun/2006:06:31:04 -0400] conn=145222 op=-1 msgId=-1 - closing - B1
    [27/Jun/2006:06:31:04 -0400] conn=145222 op=-1 msgId=-1 - closed.

  • Executing amadmin command in Unix box.  --*** Urgent*****

    I tried to execute following command on Unix machine:
    ./amadmin -u uid=amAdmin,ou=People,o=ievesp.net -v -w "password"
    -s /etc/opt/SUNWam/config/xml/amUser.xml
    I am getting following error message:
    Info 112: Entering ldapAuthenticate method!
    Success 0: No Exceptions! LDAP Authentication success!
    Info 113: Calling SSO method!
    Error 9: Operation failed: null
    Please tell me why I am getting this Error?
    Where can I find log files?
    Can anyone please help me on this?

    I suggest that you post this question to the Access Manager Forum...
    <http://swforum.sun.com/jive/forum.jspa?forumID=79>
    Regards,
    Ludovic.

  • Facing issues while executing LDAPBind command in Unix

    Dear All,
    We are trying to invoke a shell script from PeopleCode(which is having the ldapbind command) through exec command. We are able to invoke the shell script but the ldapbind command fails to execute. It throws the below error
    +"/usr/bin/ldapbind: error while loading shared libraries: libclntsh.so.10.1: wrong ELF class: ELFCLASS32"+
    Not sure whether this is an issue with the installation or configuration. Kindly help us to resolve this issue.
    however when we executed this script in unix server directly, its running successfully.
    When I have tried to invoke the shell script from PeopleCode using WinExec command, got the below error from PeopleSoft itself
    +"Function '%1' cannot be run on the application server. (2,164)+
    +A PeopleCode program that is running as part of a processing group on the application server is using a PeopleCode built-in function that is not allowed on the application server."+
    Kindly help us to understand what is missing here.
    Thanks,
    Hari.A

    Still no clue to fix this issue.
    we are able to invoke the script from PeopleCode which has the LDAPBind command. We are writing the log files after invoking this script.
    We are able to see those log files getting generated also. But it's not capturing the result of LDAPBind and looks like ldapbind command is skipped from execution.
    Please help us to understand where we are missing?
    Thanks,
    Hari.A

  • Using the MAIL command of UNIX through JAVA

    Can any one give me a lead or example on how to call the MAIL command of UNIX to send mails using JAVA.

    Use java.lang.Process for it. See the code below, it will
    help you understand how it would be possible.
    Process p = Runtime.getRuntime().exec("mail username");
    in = p.getInputStream();
    out = p.getOutputStream();
    Now stdout will be available on 'in' for reading e.g.
    you can expect Subject: and Cc: lines on linux box.
    and write data/message to 'out'. It will be the message
    which you will wrile in normal use of mail on stdin.
    Good Luck
    Mumtaz Siddiqui

  • Problem while executing a command using exec()

    I'm trying to execute a command on Unix O/S with the help of java program. For this I have used Runtime class available in java.lang. It works fine for some of the basic unix commands like 'ls','cp' but when I tried to execute command "sqlldr userid=<user>/<pwd> control=/u01/dw/snb/log/sp_shd05721_ins_stg_sqlldr.ctl" , then it's not getting executed. Please advise.

    You may be having a problem with the command path, which I don't think Runtime.exec() uses. Try specifying the full path

  • How to execute unix command in java  or jsp

    have a peace day,
    please send some sample code for
    "execute the unix command in java or jsp"
    thank you
    regards
    rex

    i execute this coding
    its compiling. while running i get the error " java.io.IOException: CreateProcess: \ls-l error=2 "
    import java.io.*;
    import java.util.*;
    public class Test
       public static void main(String[] args) throws Exception
         try
              String[] cmd = {"/ls-l"};
    Runtime.getRuntime().exec(cmd);
         catch (Exception e)
               System.out.println(e);
      }what can i do for that
    thank u

  • Execute Linux Command via JSP

    How can I execute Linux commands through a JSP page on a Red Hat Linux 6.1 Machine using Tomcat 3.0
    Please Mail your answer
    [email protected]

    Hi Nick,
    Thankx a lot, for suggestion,
    I wanted to make a page which gives me a text box to write a command and below it shows the result of that command,
    Say , I m in directory "/home/dhiraj"
    and I write in command text box : "pwd"
    it should give me the currrent path in result , which I can show in form of HTML as Results ,
    (may be in a String form..)
    same way if I write in command box : "ls -l"
    it should Return me (say a String) the directory listing of the current path in result,
    I have already tried the Runtime & Process class ,
    Runtime rt = Runtime.getRuntime();
    Process p =null;
    p = rt.exec("command here");
    p.waitFor();
    it has following problems:
    1) This way I m not able to get the result ..
    2) I tried to make a zip file via my program it did not threw any exception , but could not execute...
    I was confused is it 'coz of permission ( rights problem) or some programmatical error as the same program runs via a Java Class file ..
    desperately waiting for ur suggestions
    Dhiraj Agrawal
    MCA student and a Trainee in a local Software House
    reply to: [email protected]

  • Need to execute Linux Commands in JSP

    Hi I am Srinivas,
    I am new to this forum,
    {color:#ff0000}I want to execute Linux Commands(which is remotely connected through putty) in a JSP Page.{color}
    {color:#0000ff}My requirement is to display df -h output on a JSP page.{color}
    This is because we will monitor disk space at regular intervals.
    Can anyone help me in this regard.
    Thanks & Regards
    Srinivas V.
    Edited by: Srini-XIUS on Mar 24, 2008 2:06 AM

    I think you might need the java 'robot' class.
    However, a JSP page displayed on a browser is running in a secure enviornment that will probably not let you access the computer its running on. Instead, create a serlvet back on the server that runs the robot class. The servlet will send the data to the jsp page for display. The jsp page can send commands to the servlet which will execute it via its robot class.

  • How can I connect to a UNIX server to execute a command?

    How can I connect to a UNIX server and execute a command using PowerShell? My shell script is sitting on one server, while the UNIX box is on another.
    also, I don't like the idea of hardcoding a username/password within the script file in order to do so.
    -Nothing to see. Move along.

    You will need a library to handle SSH connections.
    I'm using SSH.NET, you can find info on it here : http://www.powershelladmin.com/wiki/SSH_from_PowerShell_using_the_SSH.NET_library
    It has a bit of a learning curve but the web site has some fairly good tutorials.

  • Execute command on UNIX and get the result

    I want to write a Java program, which can execute a shell script in UNIX and get back the result. Any idea?

    Check these two tips:
    How to execute a command from code
    http://www.java-tips.org/java-se-tips/java.lang/how-to-execute-a-command-from-code.html
    How to read output from a Command execution
    http://www.java-tips.org/java-se-tips/java.lang/how-to-read-output-from-a-command-execution.html

  • Facing Problem while executing a command through WLST

    Hi,
    Iam using Weblogic 11g(10.3.2).Whenever I execute the below command in WLST on windows it is working fine.
    reassociateSecurityStore(domain="base_domain",admin="cn=orcladmin",password="welcome1",ldapurl="ldap://<hostname>:389",servertype="OID",jpsroot="cn=jpsroot_idm_idmhost1")
    But whenever i execute the same in Linux,it is throwing the error as below:
    wls:/base_domain/serverConfig> reassociateSecurityStore(domain="base_domain",admin="cn=orcladmin",password="welcome1",ldapurl="ldap://<hoistname>:389",servertype="OID",jpsroot="cn=jpsroot_idm_idm1")
    Traceback (innermost last):
    File "<console>", line 1, in ?
    NameError: reassociateSecurityStore
    Please suggest....
    Regards
    Pavan

    Facing Problem while executing a command through WLST

  • Execute dos commands through java

    Hi,
    Im trying to execute dos commands through java like
              try {
                   java.lang.Runtime.getRuntime().exec("cmd /c cls");
              }catch(IOException e){
                   System.out.println(e.getMessage());
              }Not sure if its possible? however
    open notepad would work
              try {
                   java.lang.Runtime.getRuntime().exec("notepad");
              }catch(IOException e){
                   System.out.println(e.getMessage());
              }Im trying to execute a cls commands to clear screen but without luck.

    The question is, which shell do you want to clear?
    I don't really know, but it could be that Runtime.exec executes its command in a new shell window...

  • JSP executing FTP command

    Hi All,
    I'm a new developer in JSP. I'm just curious about Connecting to FTP Server by JSP. Can JSP use to execute ftp command or execute to FTP server? I want to display the list of files in directory on the ftp server. So, Please suggest your initiative or show the simple code for implement it.
    Regards,
    catjom

    JavaWorld published an article about this topic. It is called "Java FTP client libraries reviewed" and it can be found here :
    http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html
    Best regards
    Jean-Pierre Norguet
    Jean-Pierre Norguet
    JavaWorld Press
    http://wasa.ulb.ac.be/jp.html

  • How to execute EXP backup command of Oracle from JSP

    hi frens !!!
    i want a method by which i can call an EXP command of oracle in JSP.
    thanks and regards
    Allwyn

    No, you don't want that. Your JSP should not know that there is such a thing as a database.

Maybe you are looking for