• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Using java process to write file failes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using java process to write file failes


  • Subject: Using java process to write file failes
  • From: Wolfram Stebel <email@hidden>
  • Date: Wed, 07 Sep 2005 15:14:35 +0200

Hi all,

i'm trying to extract some data from my apache logs.
the following code creates a file (owner appserver:admin) first.
With the "more | grep" i try to append data to the file.
This gives me the error "access denied", so i think, the Process p is not
running under "appserver" user.
How can i do such shell commands under the correct user?
Clearly, in development the code does the job without access problems.

Thanks for any pointers


Wolfram

Code in my WOComponent:



// write new log file
File newLog = new File ( clientLogData );
newLog.delete ();
newLog.createNewFile ();

// construct command for process
String command1 = "more " + monthLogFile + " | grep /" + clientAlias + "/ >>
" + clientLogData;

try
{
    // execute command
    Process p = Runtime.getRuntime ().exec ( command1 );
    int terminated = p.waitFor ();
    if ( NSLog.debugLoggingAllowedForLevel ( NSLog.DebugLevelDetailed  ) )
    {
         NSLog.out.appendln ( "terminated (0=OK) : " + terminated );
         BufferedReader err = new BufferedReader( new InputStreamReader (
p.getErrorStream () ) );
         NSLog.out.appendln ( "error: " + err.readLine () );
    }
}
....


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Using java process to write file failes
      • From: Sacha Mallais <email@hidden>
  • Prev by Date: Re: AW: Delete a table content
  • Next by Date: Unable to write file (java file creation)
  • Previous by thread: Client- and server-side classes?
  • Next by thread: Re: Using java process to write file failes
  • Index(es):
    • Date
    • Thread