What is it that you're really trying to do? Do you want to run a process
as another user on a Unix machine? If so, then you would use the
<username> sub-element for a <process> element. The <username> element
specified the user names under which the process should be started. You
should also read about the USERNAME option for a PROCESS START request in
section "8.12 Process Service" in the STAF User's Guide (as the STAX
service uses the <username> value and submits a PROCESS START request
under the covers specifying the USERNAME option). Note that in order to
run a process on a machine as another user, STAFProc must have been
started on that machine when logged in as root and you must set the
PROCESSAUTHMODE operating parameter to None on the Unix machine where the
process is going to be run (which can be done dynamically via a PROCESS
SET PROCESSAUTHMODE request or via the STAF.cfg file on the Unix machine).
For example, to run a process as user p4 on unix machine client1 using
STAF commands:
# STAF client1 PROCESS SET PROCESSAUTHMODE None
Response
--------
# STAF client1 PROCESS START SHELL COMMAND "whoami" USERNAME p4
RETURNTSTDOUT STDERRTOSTDOUT WAIT
Response
--------
{
Return Code: 0
Key : <None>
Files : [
{
Return Code: 0
Data : p4
}
]
}
Note that I just ran command "whoami" to run that the process is being run
as user p4. Instead, you would specify the real command that you want to
run as user p4 instead of specifying command "whoami".
In STAX, you could do this as follows:
<stafcmd name="'Set PROCESSAUTHMODE'">
<location>'client1'</location>
<service>'PROCESS'</service>
<request>'SET PROCESSAUTHMODE None'</request>
</stafcmd>
<if expr="RC != 0">
<log message="1">
'STAF client1 PROCESS SET PROCESSAUTHMODE None\nFailed with RC=%s
Result=%s' % \
(RC, STAFResult)
</log>
<return>'Failed'</return>
</if>
<process>
<location>'client1'</location>
<command mode="'shell'">'whoami'</command>
<username>'p4'</username>
<stderr mode="'stdout'"/>
<returnstdout/>
</process>
<if expr="RC == 0">
<log message="1">
'Process succeeded. Stdout/Stderr: \n%s' % (STAXResult)
</log>
<else>
<log message="1">
'Process failed. RC= %s STAFResult=%s STAXResult: \n%s' % \
(RC, STAFResult, STAXResult)
</log>
</else>
</if>
--------------------------------------------------------------
Sharon Lucas
IBM Austin, [EMAIL PROTECTED]
(512) 838-8347 or Tieline 678-8347
Vijita <[EMAIL PROTECTED]>
11/05/2008 01:42 AM
To
staf-users@lists.sourceforge.net
cc
Subject
[staf-users] Using pipe in shell command
Hi,
I want to write
echo passwd| login p4
this command to automate p4 login.
Can anybody please help me with how to write piped command in STAX xml job
file?..
Please reply.
Thanks,
Vijita.
---------- Forwarded message ----------
From: Vijita <[EMAIL PROTECTED]>
Date: Wed, Nov 5, 2008 at 12:17 PM
Subject: Setting environmental variables
To: staf-users@lists.sourceforge.net
Hi all,
I want to set environmental variable for perforce, P4PORT and P4USER in
STAX xml job file.
How can I do that?
I have written,
<script> user = 'p4user=vijita' </script>
<process name="'set evn p4port'">
<location>image</location>
<command mode="'shell'">'set'</command>
<parms>'%s' % (user)</parms>
<stdout>'d:/p4port.txt'</stdout>
<stderr mode="'stdout'"/>
<returnstdout/>
</process>
but its not working. Any suggestions please??
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users