Reading output of a system call

Hi,
It appears that java system call does not return a value in Netware OS.
The same code functions flawlessly on other OS'es, eg. linux and windows.
If the following code is run on a Netware (6.5), the following error is
returned:
External App Returned:
java.io.IOException: Bad file number
Does anyone knows how to receive the values from the system call on Netware?
To reproduce the problem, do the following:
1) save the included source code to netware server's sys:java/classes
with a filename ExecuteExternalApp.java
2) compile it issuing a console command:
javac sys:java/classes/ExecuteExternalApp.java
3) execute the application:
java ExecuteExternalApp volumes
This should successfully launch the system command "volumes" but also
would give an error message:
External App Returned:
java.io.IOException: Bad file number
---- Source code
import java.io.*;
public class ExecuteExternalApp{
public static String executeSystemCommand(String command) throws
Exception {
String ret = "";
try
Process process = Runtime.getRuntime().exec(command);
BufferedReader input = new BufferedReader(new
InputStreamReader(process.getInputStream()));
BufferedReader err = new BufferedReader(new
InputStreamReader(process.getErrorStream()));
//InputStreamReader iar = new
InputStreamReader(process.getInputStream());
StringBuffer sb = new StringBuffer();
String line = "";
//while ((line = input.readLine()) != null)
//testi tuleeko yksi rivi
line = input.readLine();
sb.append(line);
input.close();
ret = sb.toString();
catch (Exception err)
ret = err.toString();
return ret;
public static void main(String[] args) throws Exception {
if (args.length > 0){
String output = executeSystemCommand(args[0]);
System.out.println("External App Returned:");
System.out.println(output);
else
System.out.println("Usage: ExecuteExternalApp <command>");

Guenter wrote:
> Hi Jonne,
> Jonne Viljanen <jonne.viljanen@rmv_this.helsinki.fi> wrote in
> news:y%[email protected]:
>
>> Thank you for your effort. I've been trying to write a simple program
>> that would monitor if any cluster resource would be in comatose and in
>> such case, it would try to online the resource on some other cluster
>> node. For this I'd need to run these system commands and parse their
>> output:
>>
>> - "cluster resources" - to see if any resource is in comatose
>>
>> and
>>
>> - "cluster view" - to determine which nodes are online.
>>
>> Also i'd need to run "cluster offline resource" and "cluster online
>> resource node", but for these command I would not need to get the
>> output.
>>
>> I know that my approach is a bit clumsy, but it's beauty is in its
>> simplicity. Novell's engineer suggested that with a bit more effort one
>> could read the data from ldap or cluster related virtual XML files on
>> the _Admin volume. I think that I should investigate the latter
>> approach, since I'd like to avoid handling the ldap authentication. I
>> appreciate any comments and suggestions. Code examples are also greatly
>> welcomed ;-)
> hmmm, well that sounds to me as if the language doesnt matter at all since
> finally you most likely fire your app from cron to do these tasks frequently
> automatically, right? Therefore I'd suggest you take a look at Perl - it
> seems better suited for these tasks; look at sys:/perl/scripts where you find
> Perl scripts which do already some cluster stuff, and AFAICT these make use
> of the _ADMIN volume.
> Additional info and Perl samples can be found with the VFS NDK IIRC:
> http://developer.novell.com/wiki/ind..._File_Services
>
> greetz, Gnter.
>
Hi Gnter,
Thank you for your excellent help. I started to play with the _ADMIN
-volume today. I was amazed to see how much can be done with it. I got
my little cluster watch application almost working in just 1 hour, but
then spent the rest of the day trying to get it fully functional ;-) I
still cannot figure out what is wrong with my code, so I was wondering
if I could get any help from this newsgroup.
I'm able to read the *.xml files and determine the cluster state and all
the information I need. However I dont seem to be able to write the
command files. I'm trying the following:
public void offlineClusterResource(String resourceName) {
String fileName = "_ADMIN:/Novell/cluster/Resource.cmd";
//String logFile = "sys:java/classes/ClusterWorker.log";
String commandLine = "<virtualIO><datastream
name=\"command\"></virtualIO>"+
"<ncsRequest><offline>" +
"<resource>" + resourceName + "</resource>" +
"</offline></ncsRequest>";
//Log("Turning the cluster resource " + resourceName + "
offline!!!", logFile);
try {
//PrintWriter in autoFlush mode
PrintWriter pw = new PrintWriter(new FileWriter(fileName,
false), false);
pw.println(commandLine);
pw.close();
} catch (IOException e) {
System.out.println("Unable to write " + fileName);
It seems not to write anything to _ADMIN:/Novell/cluster/Resource.cmd.
If I set the file to be eg. SYS:/tmp/Resource.cmd -it writes nicely to
the file.
What am I missing here?
Cheers,
Jonne

Similar Messages

  • Solaris 2.6 - System Call faults

    Hi Sun Forums.
    Machine Description : SunOS serv-sif 5.6 Generic_105181-28 sun4u sparc SUNW,Ultra-Enterprise
    Number of CPU's : 4 (400Mhz)
    Physical Memory : 5120 Mb
    Top Output :
    PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
    11115 syb119 2 10 0 506M 498M cpu4 179.6H 24.89% dataserver
    5078 syb119 1 0 0 1696K 1408K cpu0 0:00 0.51% top
    11113 syb119 2 58 0 506M 498M sleep 146.3H 0.09% dataserver
    3592 syb119 2 59 0 1030M 1023M sleep 282.6H 0.07% dataserver
    1193 root 1 58 0 7536K 3144K sleep 159:38 0.02% jre
    1199 root 1 59 0 3144K 1064K sleep 0:00 0.01% httpd
    3596 syb119 2 59 0 1030M 1023M sleep 110.6H 0.01% dataserver
    11114 syb119 2 58 0 506M 498M sleep 168.6H 0.00% dataserver
    3595 syb119 2 58 0 1030M 1022M sleep 151.6H 0.00% dataserver
    1182 root 1 58 0 5128K 2768K sleep 17:53 0.00% jre
    1 root 1 58 0 1648K 384K sleep 5:40 0.00% init
    19230 syb119 1 58 0 10M 1968K sleep 0:43 0.00% backupserver
    1253 root 1 58 0 16M 1624K sleep 0:43 0.00% ecoad
    1052 root 18 23 0 4736K 1608K sleep 0:42 0.00% syslogd
    1026 root 1 48 0 1904K 1144K sleep 0:41 0.00% inetd
    Possible Problem : vmstat
    procs memory page disk faults cpu
    r b w swap free re mf pi po fr de sr s6 s9 s1 sd in sy cs us sy id
    0 0 0 4710944 80856 0 0 392 0 0 0 0 0 0 0 0 3208 512747 1557 49 51 0
    The value Faults for System call = 512747 very high value.
    The process running in Solaris are working slowly ...
    Any idea ?
    PID

    It is possible that this card may not be compatible with this Solaris
    system.
    You may want to check these sites out for driver related information:
    http://soldc.sun.com/developer/support/driver/
    http://soldc.sun.com/developer/support/driver/IO_kit/PCI.html
    Thx
    Tushar Patel.

  • Write system call results to a text box

    I am making a DOS system call that creates a file. Once this file is created it gives me a "packet created successfully" message that is written to the screen.
    I am using Netbeans 5.5.1 and Swing. and I want this message to be output into a JtextArea. The system call works fine and the file is created, I just can't get the message to write to my text area.
    Below is a sample of my code:
    private void btn_importActionPerformed(java.awt.event.ActionEvent evt) {                                          
    // TODO add your handling code here:
         String Rep = txt_Repname.getText();
         String Work = txt_Workdir2.getText();
         String VOB = txt_VOBtag.getText();
         String VOBstorage = txt_VOBName2.getText();
         String Replicapath = txt_Replicapath.getText();
         String command = ("cmd /c multitool mkreplica -import -npreserve -nc -vreplica " + Rep + " -work " + Work + " -tag \\" + VOB + " -vob " + VOBstorage + " " + Replicapath);
         StringBuffer sb = new StringBuffer();
         Process p = null;
         try {
                p = Runtime.getRuntime().exec(command);
            } catch (IOException ex) {
                ex.printStackTrace();
        Scanner s = new Scanner(p.getInputStream());
        while(s.hasNextLine()) {
            sb.append(s.nextLine()+"\n");
        String result = sb.toString();
        txt_Importresults.setText(result);
        }           

    This works okay for me.
    import java.io.IOException;
    import java.util.Scanner;
    public class Tester {
         public static void main(String[] args) throws IOException {
               StringBuffer sb = new StringBuffer();
              Process p = null;
              try {
                     p = Runtime.getRuntime().exec("HELP");
                 } catch (IOException ex) {
                     ex.printStackTrace();
             Scanner s = new Scanner(p.getInputStream());
             while(s.hasNextLine()) {
                 sb.append(s.nextLine());
                 sb.append(System.getProperty("line.separator"));
             System.out.println(sb.toString());
    }Have you read the Traps article on JavaWorld?
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • System call "copy" for C++ compiler 4.2?

    System call "rename" is very close to what I am looking for but "copy" is better because I need to keep the original file. Where I can find it, or any equivalent?
    MM
    [email protected]

    I don't know of a Solaris system call to copy files. I do know there is no such C or C++ standard library function.
    It's easy enough to write a file copy routine, however.
    C++ 4.2 is obsolete and no longer supported. It predates the 1998 C++ standard by a few years.
    But using old-style C++, here is a copy-file routine:
    #include <fstream.h>
    int copyfiles(const char* i, const char* o)
    ifstream in(i, ios::in|ios::binary);
    ofstream out(o, ios::out|ios::binary);
    out << in.rdbuf();
    return !(!in && !out);
    You pass it the names of the input and output files. It opens the files in binary mode, copies input to output if possible, and reports status by returning 1 for success and 0 for failure.
    Using standard C++, the routine looks like this:
    #include <fstream>
    bool copyfiles(const char* i, const char* o)
    std::ifstream in(i, std::ios::binary);
    std::ofstream out(o, std::ios::binary);
    out << in.rdbuf();
    return !(!in && !out);

  • Debug the system-call

    hi all,
    just a little doubt.
    can we debug a system call?
    while debugging i reached a point of statement ..
    "system-call ict "
    i couldnt debug this call and directly got the output.
    plz tell me how to debug a sys-call , if at all we can.

    The only thing you can try is to switch on system debugging, but I don't think this will work for these kind of calls. On that level debugging is normally forbidden.
    System debugging is only set for debugging ABAP system programs, while SYSTEM-CALLS are processed on Kernel level.
    P.S. Switch on system debugging: While debugging, go menu->settings (I believe)->switch system debugging on / off.

  • System call support for unicodes

    Hi Solaris guru,
    One of my application (C,Solaris2.7) is required to work in multiple languages. This application makes use of system & C library calls. Is it possible for a japanese user to create file names in japanese? if so how will I able to use these names (let's assume unicodes) with standard system calls and library routines which consider file names has char *?
    I have noticed that Solaris provides wchar_t and (wchar.h) wide string library calls (Ex, wprintf, wscanf, wcstrcmp etc). are there any similar w-version of system calls?
    I greatly appreciate your help.
    Cheers
    Ramesh

    I don't know of a Solaris system call to copy files. I do know there is no such C or C++ standard library function.
    It's easy enough to write a file copy routine, however.
    C++ 4.2 is obsolete and no longer supported. It predates the 1998 C++ standard by a few years.
    But using old-style C++, here is a copy-file routine:
    #include <fstream.h>
    int copyfiles(const char* i, const char* o)
    ifstream in(i, ios::in|ios::binary);
    ofstream out(o, ios::out|ios::binary);
    out << in.rdbuf();
    return !(!in && !out);
    You pass it the names of the input and output files. It opens the files in binary mode, copies input to output if possible, and reports status by returning 1 for success and 0 for failure.
    Using standard C++, the routine looks like this:
    #include <fstream>
    bool copyfiles(const char* i, const char* o)
    std::ifstream in(i, std::ios::binary);
    std::ofstream out(o, std::ios::binary);
    out << in.rdbuf();
    return !(!in && !out);

  • "mount system call failed" what's wrong?

    Hi I have a network between two computers here. NAT works okay, but I can't share files between them.
    I followed the wiki so here goes some configuration files (server first):
    NAT.sh
    #!/bin/bash
    ifconfig eth0 192.168.0.1
    iptables -t nat -I POSTROUTING -s 192.168.0.2 -d 0/0 -j MASQUERADE
    echo 1 > /proc/sys/net/ipv4/ip_forward
    /etc/hosts.allow
    nfsd: 192.168.0.2/255.255.255.255
    rpcbind: 192.168.0.2/255.255.255.255
    mountd: 192.168.0.2/255.255.255.255
    /etc/hosts.deny
    ALL: ALL: DENY
    connectNET.sh
    /etc/rc.d/rpcbind start
    /etc/rc.d/nfs-common start
    /etc/rc.d/nfs-server start
    Result....
    :: Starting rpcbind [DONE]
    :: Starting rpc.statd daemon [DONE]
    :: Mounting pipefs filesystem [BUSY]
    :: Starting rpc.idmapd daemon [DONE]
    :: Mounting nfsd filesystem [DONE]
    :: Exporting all directories [DONE]
    :: Starting rpc.nfsd daemon [DONE]
    :: Starting rpc.mountd daemon [DONE]
    It's okay up to now, but when I type in the laptop:
    mount 192.168.0.1:/root/Desktop/Teste /media/arquivos
    it says: mount.nfs: mount system call failed.
    I made a log with tcpdump of what happens in this mounting time. Here it goes:
    the log of the desktop:
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
    21:28:57.572384 IP 192.168.0.2.48562 > 192.168.0.1.sunrpc: Flags [S], seq 3081498172, win 5840, options [mss 1460,sackOK,TS val 179694 ecr 0,nop,wscale 6], length 0
    21:28:57.572801 IP 192.168.0.1.sunrpc > 192.168.0.2.48562: Flags [S.], seq 3721592297, ack 3081498173, win 5792, options [mss 1460,sackOK,TS val 150520 ecr 179694,nop,wscale 6], length 0
    21:28:57.572896 IP 192.168.0.2.48562 > 192.168.0.1.sunrpc: Flags [.], ack 1, win 92, options [nop,nop,TS val 179694 ecr 150520], length 0
    21:28:57.572988 IP 192.168.0.2.48562 > 192.168.0.1.sunrpc: Flags [P.], ack 1, win 92, options [nop,nop,TS val 179694 ecr 150520], length 116
    21:28:57.573005 IP 192.168.0.1.sunrpc > 192.168.0.2.48562: Flags [.], ack 117, win 91, options [nop,nop,TS val 150520 ecr 179694], length 0
    21:28:57.573595 IP 192.168.0.1.sunrpc > 192.168.0.2.48562: Flags [P.], ack 117, win 91, options [nop,nop,TS val 150520 ecr 179694], length 32
    21:28:57.573656 IP 192.168.0.2.48562 > 192.168.0.1.sunrpc: Flags [.], ack 33, win 92, options [nop,nop,TS val 179694 ecr 150520], length 0
    21:28:57.573697 IP 192.168.0.2.48562 > 192.168.0.1.sunrpc: Flags [F.], seq 117, ack 33, win 92, options [nop,nop,TS val 179694 ecr 150520], length 0
    21:28:57.573745 IP 192.168.0.2.814 > 192.168.0.1.57654: Flags [S], seq 3091877297, win 5840, options [mss 1460,sackOK,TS val 179694 ecr 0,nop,wscale 6], length 0
    21:28:57.573769 IP 192.168.0.1.57654 > 192.168.0.2.814: Flags [S.], seq 3725333566, ack 3091877298, win 5792, options [mss 1460,sackOK,TS val 150520 ecr 179694,nop,wscale 6], length 0
    21:28:57.573818 IP 192.168.0.1.sunrpc > 192.168.0.2.48562: Flags [F.], seq 33, ack 118, win 91, options [nop,nop,TS val 150520 ecr 179694], length 0
    21:28:57.573826 IP 192.168.0.2.814 > 192.168.0.1.57654: Flags [.], ack 1, win 92, options [nop,nop,TS val 179694 ecr 150520], length 0
    21:28:57.573864 IP 192.168.0.2.814 > 192.168.0.1.57654: Flags [P.], ack 1, win 92, options [nop,nop,TS val 179694 ecr 150520], length 44
    21:28:57.573875 IP 192.168.0.1.57654 > 192.168.0.2.814: Flags [.], ack 45, win 91, options [nop,nop,TS val 150520 ecr 179694], length 0
    21:28:57.573878 IP 192.168.0.2.48562 > 192.168.0.1.sunrpc: Flags [.], ack 34, win 92, options [nop,nop,TS val 179694 ecr 150520], length 0
    21:28:57.573946 IP 192.168.0.1.57654 > 192.168.0.2.814: Flags [P.], ack 45, win 91, options [nop,nop,TS val 150520 ecr 179694], length 24
    21:28:57.574000 IP 192.168.0.2.814 > 192.168.0.1.57654: Flags [.], ack 25, win 92, options [nop,nop,TS val 179694 ecr 150520], length 0
    21:28:57.574031 IP 192.168.0.2.814 > 192.168.0.1.57654: Flags [F.], seq 45, ack 25, win 92, options [nop,nop,TS val 179694 ecr 150520], length 0
    21:28:57.574101 IP 192.168.0.1.57654 > 192.168.0.2.814: Flags [F.], seq 25, ack 46, win 91, options [nop,nop,TS val 150520 ecr 179694], length 0
    21:28:57.574162 IP 192.168.0.2.814 > 192.168.0.1.57654: Flags [.], ack 26, win 92, options [nop,nop,TS val 179694 ecr 150520], length 0
    and the log of the laptop:
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
    21:31:17.028990 IP 192.168.0.2.40571 > 192.168.0.1.sunrpc: Flags [S], seq 1631273214, win 5840, options [mss 1460,sackOK,TS val 233744 ecr 0,nop,wscale 6], length 0
    21:31:17.029460 IP 192.168.0.1.sunrpc > 192.168.0.2.40571: Flags [S.], seq 2263960074, ack 1631273215, win 5792, options [mss 1460,sackOK,TS val 204571 ecr 233744,nop,wscale 6], length 0
    21:31:17.029496 IP 192.168.0.2.40571 > 192.168.0.1.sunrpc: Flags [.], ack 1, win 92, options [nop,nop,TS val 233744 ecr 204571], length 0
    21:31:17.029738 IP 192.168.0.2.40571 > 192.168.0.1.sunrpc: Flags [P.], ack 1, win 92, options [nop,nop,TS val 233744 ecr 204571], length 116
    21:31:17.029825 IP 192.168.0.1.sunrpc > 192.168.0.2.40571: Flags [.], ack 117, win 91, options [nop,nop,TS val 204571 ecr 233744], length 0
    21:31:17.029907 IP 192.168.0.1.sunrpc > 192.168.0.2.40571: Flags [P.], ack 117, win 91, options [nop,nop,TS val 204571 ecr 233744], length 32
    21:31:17.029922 IP 192.168.0.2.40571 > 192.168.0.1.sunrpc: Flags [.], ack 33, win 92, options [nop,nop,TS val 233744 ecr 204571], length 0
    21:31:17.029967 IP 192.168.0.2.40571 > 192.168.0.1.sunrpc: Flags [F.], seq 117, ack 33, win 92, options [nop,nop,TS val 233744 ecr 204571], length 0
    21:31:17.030017 IP 192.168.0.2.ftps > 192.168.0.1.57654: Flags [S], seq 1616938438, win 5840, options [mss 1460,sackOK,TS val 233744 ecr 0,nop,wscale 6], length 0
    21:31:17.030057 IP 192.168.0.1.sunrpc > 192.168.0.2.40571: Flags [F.], seq 33, ack 118, win 91, options [nop,nop,TS val 204571 ecr 233744], length 0
    21:31:17.030068 IP 192.168.0.2.40571 > 192.168.0.1.sunrpc: Flags [.], ack 34, win 92, options [nop,nop,TS val 233744 ecr 204571], length 0
    21:31:17.030094 IP 192.168.0.1.57654 > 192.168.0.2.ftps: Flags [S.], seq 2252792193, ack 1616938439, win 5792, options [mss 1460,sackOK,TS val 204571 ecr 233744,nop,wscale 6], length 0
    21:31:17.030106 IP 192.168.0.2.ftps > 192.168.0.1.57654: Flags [.], ack 1, win 92, options [nop,nop,TS val 233744 ecr 204571], length 0
    21:31:17.030242 IP 192.168.0.2.ftps > 192.168.0.1.57654: Flags [P.], ack 1, win 92, options [nop,nop,TS val 233744 ecr 204571], length 44
    21:31:17.030312 IP 192.168.0.1.57654 > 192.168.0.2.ftps: Flags [.], ack 45, win 91, options [nop,nop,TS val 204571 ecr 233744], length 0
    21:31:17.030402 IP 192.168.0.1.57654 > 192.168.0.2.ftps: Flags [P.], ack 45, win 91, options [nop,nop,TS val 204571 ecr 233744], length 24
    21:31:17.030411 IP 192.168.0.2.ftps > 192.168.0.1.57654: Flags [.], ack 25, win 92, options [nop,nop,TS val 233744 ecr 204571], length 0
    21:31:17.030469 IP 192.168.0.2.ftps > 192.168.0.1.57654: Flags [F.], seq 45, ack 25, win 92, options [nop,nop,TS val 233744 ecr 204571], length 0
    21:31:17.030560 IP 192.168.0.1.57654 > 192.168.0.2.ftps: Flags [F.], seq 25, ack 46, win 91, options [nop,nop,TS val 204571 ecr 233744], length 0
    21:31:17.030573 IP 192.168.0.2.ftps > 192.168.0.1.57654: Flags [.], ack 26, win 92, options [nop,nop,TS val 233744 ecr 204571], length 0
    21:31:17.422459 IP 192.168.0.2.38930 > dns1.ctb.virtua.com.br.domain: 26889+ PTR? 1.0.168.192.in-addr.arpa. (42)
    21:31:17.443879 IP dns1.ctb.virtua.com.br.domain > 192.168.0.2.38930: 26889 NXDomain* 0/1/0 (109)
    21:31:17.444066 IP 192.168.0.2.44084 > dns1.ctb.virtua.com.br.domain: 61138+ PTR? 2.0.168.192.in-addr.arpa. (42)
    21:31:17.455870 IP dns1.ctb.virtua.com.br.domain > 192.168.0.2.44084: 61138 NXDomain* 0/1/0 (109)
    21:31:17.456295 IP 192.168.0.2.48348 > dns1.ctb.virtua.com.br.domain: 13686+ PTR? 87.77.250.200.in-addr.arpa. (44)
    21:31:17.481928 IP dns1.ctb.virtua.com.br.domain > 192.168.0.2.48348: 13686 3/3/3[|domain]
    I don't understand what's happening. Do you have any ideas??
    Thanks in advance!!

    Sorry for the useless post but:
    1) Arch forums are amazing, I use arch exclusively now, but I always go t google first, find a few bad results, go to the arch forums and find a solution rapidly, here is another case of that.
    2) The names of the users in this post are "ILoveJapaneseGirls" and "IHateJapaneseDolphinKille"... that is amazing.

  • Need help system call

    hi guys i need help i want to know how to call a prog to run and excute with java a command like shell in VB and System in c

    Use Runtime. You have to make sure you read the output or the program will hang...
    Runtime rt = Runtime.getRuntime();
    Process rtProcess = rt.exec(cmd);
    String result = readSTDOUT(rtProcess);
    String readSTDOUT(Process p) throws Exception {
        InputStream in = p.getInputStream();
        byte [] output = new byte [1024];
        int len;
        StringBuffer buf = new StringBuffer();
        while((len = in.read(output)) >= 0) {
          buf.append(new String(output, 0, len));
        in.close();
        // check stderr if stdout was empty.
        if (buf.length() == 0 ) {
          in = p.getErrorStream();
          while((len = in.read(output)) >= 0) {
            buf.append(new String(output, 0, len));
          in.close();
        return buf.toString();
      }

  • Correct Forum? CGI and Server behaviour on Solaris at system()-call

    Hi to you all,
    Do not know if i am in the correct forum, but maybe it is a Webserver problem.
    I have Sun ONE Webserver 6.1 running on Solaris.
    Craete some CGI`s in C.
    Now I have a problem with one CGI, which have to call a Shellscript via system() call.
    The Client just calls the CGI with some parameters, which will write the informations in a file with some additional informations from a database, after that, the script should be startet and do some printjobs in the background.
    The CGI and the Shell-script is working fine. My Problem is, that the system() call always waits, until the ShellScript has finished, so the Webserver send the "data successful written" site after a couple of minutes, it should send it immeditatly to the client, so the session is closed.
    I have tried to put the shellscript in background with "&", also with nohup and a second shell script which justs starts the first script, also with all combinations of nohup and "&" for background process.
    also i tried with "pclose(popen(SCRIPT,"W");" to call the script, it is always the same, the session will close only, when the script has been finished.
    In an other Forum I found an entry, that , however, IPlanet webserver always will do this in this way. The session will be closed, when all called processes has benn fisnished.
    Any Ideas to solve my problem?

    The web server reads from the CGI program's stdout. It knows the HTTP response is complete when the CGI program closes its stdout.
    When you call system(), the child process inherits the CGI program's stdout and keeps it open until it finishes. If you want the child process to run asynchronously from the HTTP response, you should give the child process a new stdout with > /dev/null. (You'll still need to place the child process in the background with &.) Alternatively, you can fork(), close(1), then exec().

  • Tracing what is happening in the connect() system call

    I've been playing around with some of the recipies in dtrace today trying to find out why it takes so long to connect from a linux machine to an ultra 5 running sendmail but I'm not having a lot of luck.
    The one thing I can find is that the amount of time for the connect system call to return takes a long time. Here's the dtrace script I wrote (borrowing from Bryan Cantrill's blog):
    bash-2.05b# cat functiontime.d
    #!/usr/sbin/dtrace -s
    #pragma D option flowindent
    syscall::connect:entry
    /execname == "sendmail"/
    self->start = vtimestamp;
    syscall:::entry,
    syscall:::return
    /self->start/
    trace(vtimestamp - self->start);
    syscall::connect:return
    /execname == "sendmail"/
    self->start = 0;
    exit(0);
    This is the output:
    bash-2.05b# ./functiontime.d
    dtrace: script './functiontime.d' matched 454 probes
    CPU FUNCTION
    0 => connect 0
    0 | connect:return 303079
    0 <= connect
    I know there are other syscalls going on from the time connect enters to the time it returns but I have no idea how to get them to print.
    Any ideas how I can make this script more useful to see exactly where sendmail is getting hung up?

    You might also try something like
    #!/usr/sbin/dtrace -s
    #pragma D option flowindent
    syscall::connect:entry
    /execname == "sendmail"/
            self->depth = 1;
            self->syscallstart = timestamp
    fbt:::entry
    /self->depth/
            self->start[self->depth] = timestamp;
            trace(self->start[self->depth++] - self->syscallstart);
    fbt:::return
    /self->depth/
            this->delta = timestamp - self->start[--self->depth];
            @func[probefunc] = quantize(this->delta);
            printf("delta is %d\n", this->delta);
            self->start[self->depth] = 0;
    syscall::connect:return
    /self->depth/
            exit(0);
    }This will give you the function call flow inside the kernel along with the following:
    - on function entry, a time delta since connect was called
    - on function exit, how long we spent in the function
    - on return from the connect system call, a list of histograms showing the call times for all functions called
    You are probably going to want to redirect the output as it gets big.
    Also note, I've written this to give the information only for the first call to connect.
    Alan.
    Alan Hargreaves - http://blogs.sun.com/tpenta
    Senior Technical Support Specialist/VOSJEC Engineer
    Product Technical Support (APAC)
    Sun Microsystems

  • Making system calls in java

    I want to join some split files into one. In command prompt I use COPY /B file.1+file.2 file to join the files. How can i do the same in my java application. Please show the code which I suppose will use getRuntime. Thanks in advance.

    Well if there is a problem with system calls then can
    you tell me if there is a class in java for
    concetanating files. Not directly.
    At present I am joing the files
    by reading each byte from the files and writing them
    to another file which takes hell lot of time. You should read the files in large chunks. Much much faster.
    Thanks
    in advance again. Also if you say about sequential
    file class then please expalin a bit bcs I couldn't
    implement it.Post the code you are having trouble with explaining what it should do and what it actually does.

  • Unix system() system call in Java

    Hi,
    system() call in Unix is very helpfull when you need to implement a piece of code that is already implemented in an exsiting utility.
    Is there a way to achive a similar functionality?
    To put it in simpler words - is there a way, in Java, to call some method that will invoke a Unix shell and will execute the command specified in the string that is past in?
    Could you please CC the reply to [email protected]
    Thanks,
    -Michael

    Runtime.exec()
    > Could you please CC the reply to [email protected]
    Certainly not.

  • Can I source an environment before making a system call from the database

    I can execute system calls from the database like
    Process proc = Runtime.getRuntime().exec("env");
    but I am unable to source an environment before making the call.
    Our goal is to from within the database to execute tkprof on a
    raw trace file then load both files into clobs in a table. We can load
    the raw trace no problem, we just cannot figure out how to execute
    tkrprof on the raw trace then load its output.
    Anyone know if this is possible to hava java get a runtime and then call
    an environment file to source the environment so that path's and other environment variables are set prior to executing another system command.

    Thanks for that...but can I do multiple edits in my Stored Procedure Vaibhav and pass back something that I can then utilize in my SSIS? For example...
    One and Only one Member Span...so I'd be doing a SELECT COUNT(*) based on my match criteria or handle the count accordingly in my Stored Procedure and passing something back via the OLE DB Command and handling it appropriately in SSIS
    Are there "Diabetes" claims...again probably by analyzing a SELECT COUNT(*)
    Am I expecting too much from the SSIS...should I be doing all of this in a Stored Procedure? I was hoping to use the SSIS GUI for everything but maybe that's just not possible. Rather use the Stored Procedure to analyze my stged data, edit accordingly, do
    data stores accordingly...especially the data anomalies...and then use the SSIS to control navigation
    Your thoughts........
    Could you maybe clarify the difference between an OLE DB Command on the Data Flow and the Execute SQL Task on the Control Flow...
    You can get return values from oledb comand if you want to pipeline.
    see this link for more details
    http://josef-richberg.squarespace.com/journal/2011/6/30/ssis-oledb-command-and-procedure-output-params.html
    The procedure should have an output parameter defined for that
    I belive if you've flexibility of using stored procedure you may be better off doing this in execute sql task in control flow. Calling sp in data flow will cause it to execute sp once for each row in dataset whereas in controlflow it will go for set based
    processing
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to set "Dirty" view flag to make a system call WDDOMODIFYVIEW again

    Hi!
    When a button is hit I want to mark my view "Dirty" so that system call WDDOMODIFYVIEW again. I need this to refresh/rebuild the view after user action.

    Anurag, you right. I've created simple WD application and WDDOMODIFYVIEW is called after every button hit.
    But it my case I've added button to a standard component (FPM_OIF_COMPONENT) by means of Enhancement Points. And hitting this button does not lead to call of WDDOMODIFYVIEW method. Though all standard buttons in the componend do lead to call of this method.
    Strange behavior.
    I thought, may be there is a way to "force" system to invoke this method. Like set view to some status "Needs to be redrawn", "Dirty", "Invalid", etc.

  • JSP XML output to file system

    I hava a JSP application that uses the XDK to query the database and display XML rowset data to a JSP. This rowset data can be a few hundred rows or up to 50,000 rows,
    as we publish technical manuals, parts manuals and wiring manuals for aircraft.
    Getting the data to display within the JSP is not a problem. The problem is
    that the XML rowset data shares two purposes:
    1. Query by Example, returning
    XML formatted data for display within a browser.
    2. Use of the XML formatted
    data as an external entity file for our SGML authoring software to print the
    paper publication.
    The JSP I developed (I'm not sure I should take credit for it) uses the XMLData bean and it will open the browser File/SaveAs dialog in both Netscape (Unix) and IE5.5 (Windows). HOWEVER, when I create a second JSP to perform the same task on a different table the JSP errorpage shows with no error and no errors within the JDeveloper console. This has been kicking my butt for some time, and would very much appreciate a workable solution. I will share whatever I can share with the provider. Here is the JSP code.
    =============================================
    <?xml version="1.0"?>
    <%@ page language = "java" errorPage="errorpage.jsp" import = "java.io.*, java.util.*, oracle.jbo.*, javax.naming.*, oracle.jdeveloper.html.*, oracle.jbo.html.databeans.*" contentType="text/html;charset=ISO-8859-1" %>
    <jsp:useBean class="oracle.jbo.html.databeans.XmlData" id="h25EqXml" scope="request" >
    <%
    h25EqXml.setResultElement("equiptbl");
    h25EqXml.setReleaseApplicationResources(true);
    h25EqXml.setDisplayAttributes("Ein,Pnr,Nomen,Cage,Diagnbr,Sht,Effect");
    h25EqXml.initialize(pageContext,"h25Wires_JspApp_h25Wires_be_H25Wires_beModule.HU25A_Equipment");
    response.setContentType("text/sgml");
    response.setHeader("Content-location","attachment;filename="+"equiptbl.sgm");
    ServletOutputStream sos = response.getOutputStream();
    BufferedInputStream bis = new BufferedInputStream (new FileInputStream("equiptbl.sgm"));
    int data;
    while((data = bis.read()) != -1)
    sos.write(data);
    bis.close();
    sos.flush();
    sos.close();
    %>
    <jsp:forward page= "HU5A_Equipment_Browse.jsp" />
    </jsp:useBean>
    ============================================
    The code for the other pages is the same with the exception of the filename xxx.sgm and the bean id.
    I very much appreciate your help. Thanks!
    null

    Hello Paulo,
    thank you for your answer, but i'm using type 04 XML for SEPA.
    when i select Type XML, the fields "output to file system" and "filename" are hidden.
    i dont understand why ...

Maybe you are looking for

  • Apple ID Issues -- Using same apple ID on two devices...

    I just got an Macbook Air. My daughter has been using my Apple ID to Facetime with her friends on her iPod Touch.  Now, my Macbook and her iPod are using the same address (my email address) to Facetime.  This is very confusing.  How do I fix this? Do

  • How do I update a brand new phone pryer to restoring?

    I just got a new phone and I want to restore a backup on my computer, but to do so, it's telling me that I must update the phone before I restore, but won't let me proceed without restoring! How do I update the phone and then restore it?

  • Sometime works, sometime doesn't

    Hello Good Morning! I create an application and I redo again but I have hard time to figure out. I don't want to cop the application. If anyone wants to share, please let me know. This is long story: I am developing an application that includes 3 pag

  • Calculated key figures before aggregation

    Hi, I'm having trouble creating a new calculated key figure. Here's the situation. I have two key figures: stock, value A. Now I want to create a new calculated key figure (in 3.x) using both key figures. The calculation would look something like: "s

  • Open Recent, annoying behavior.

    On my MacBook Pro running Mac OS 10.5.6 the command Open Recent (File > Open Recent) doesn't work for titles like Pages, Automator, Text Editor... While for other titles is does work: MS Word, MS Exel... I find this very annoying. On my Power Mac G5