Re(2): Command line from Java (through AppleScript)
Re(2): Command line from Java (through AppleScript)
- Subject: Re(2): Command line from Java (through AppleScript)
- From: "Robert Snyder" <email@hidden>
- Date: Sat, 4 Sep 2004 18:53:42 -0400
- Organization: Penn State World Campus
Nathan,
We do some command-line actions from within our WO applications.
One of them is a nightly batch process that does a dce_login using a
keytab file and then edit files stored in DFS to remove expired accounts
from a .htgroup file.
The other is done when a person registers for a course to add the new
users ID to the .htgroup for the specific course.
In both cases WO is feeding data to perl script that actually does the
work on the UNIX file system. It would seem you could use the same type
of combination to execute the cli commands outlined in the OSX Server
Command-Line book for account management.
Generally this is method.
First we collect the set of information we want to process at the cli,
then once we have the list of user IDs for the specific course (for the
nightly expired students process) or in memory for the user who is being
registered, we do the following
try{
Runtime runtimeObject = Runtime.getRuntime();
Process processObject = runtimeObject.exec(
AT THIS POINT WE CONSTRUCT THE CLI COMMANDS FROM TEXT + propertyForKey
values.;
processObject.waitFor();
if( processObject.exitValue() != 0 ) {
InputStream errorStream = processObject.getErrorStream();
byte [] errorByte = new byte[256];
errorStream.read(errorByte);
throw new Exception( new String(errorByte) );
}
}
We wait to see if there is an error and if so, we construct an email that
is sent to the sys admin to alert them to the the problem for human
intervention. In two plus years, this has only failed if there is a
problem with DCE, which in your case would not come into play. Since you
are adding the users on the local system, the system should always be
available.
The biggest issue that I see you facing is being able to execute the cli
commands as a user with the proper privileges to create a user account.
Obviously, you would never want to allow the application server user to
have administration rights on your box--bad juju.
Is there a keytab login equivalent in OSX unix?
Robert
On Sat, Sep 4, 2004, Nathan Dumar wrote:
>Nathan
>
>I don't know if it would help you, but here's an article about
>interacting with AppleScript from within Java:
>
>http://www.macdevcenter.com/pub/a/mac/2003/02/25/apple_scripting.html
>
>You can execute shell commands from AppleScript (w/ or w/o Terminal):
>http://www.apple.com/applescript/terminal/
>
>Whether you want to take the extra step (Java -> AppleScript -> command
>line) is another story.
>
>Nathan
>
>
>On Sep 3, 2004, at 3:29 PM, Nathan Walker wrote:
>
>> I was looking for ERXRuntimeUtilities in the current 2.0 release of
>> Wonder and I don't see it.
>> Anybody know where it is ?
>>
>> I need to call some command-line calls from my WOapp to automatically
>> add somebody to the
>> NetInfo Manager Database. by the way, anybody got a script to do this
>> already ??
>> also, what is the command to enable mail access for a user (Like when
>> I add a user in
>> Workgroup Manager on X Server and I enable Mail access for them and
>> specify the server)...how would I do this
>> with the command line or how could I call it from WO ??
>>
>> Thanks,
>>
>> -------------------
>> Nathan Walker
>> 229-460-2677
>> _______________________________________________
>> webobjects-dev mailing list | email@hidden
>> Help/Unsubscribe/Archives:
>> http://www.lists.apple.com/mailman/listinfo/webobjects-dev
>> Do not post admin requests to the list. They will be ignored.
>_______________________________________________
>webobjects-dev mailing list | email@hidden
>Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/
>webobjects-dev
>Do not post admin requests to the list. They will be ignored.
>
>
____________________________________________
Robert Snyder, Director
World Campus Data Management Services
The Pennsylvania State University
105 Mitchell Building
University Park PA 16802
Phone: 814-865-0912 Fax: 814-865-4406
E-mail: email@hidden
URL: http://www.worldcampus.psu.edu
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.