Release Automation

  • 1.  Export command in unix

    Posted Jul 06, 2018 10:04 AM

    I need assistance in a scenario where I want to export some variable in m00431 user while i am login on server with capio user. Can someone assist on this?

     

    Login at cappoc server

    [dp794d@cappoc ~]$ sudo -iu capio
    cappoc:/home/capio>

     

    (m00431) NOPASSWD: ALL, 

    (capio) NOPASSWD: ALL



  • 2.  Re: Export command in unix
    Best Answer

    Broadcom Employee
    Posted Jul 08, 2018 10:50 PM

    Hi,

     

    Do you mean that you want to set environment variable of m00431 to parameter?

    I have not tried actually, so this is just idea.

    You can create a shell script included "su m00431 and printenv" to extract env list to a text file, and run the script using [Run Command Line] action type. As next action, you can use some action types like [Extract Text from a File] or [Arrays - Read String Array from Text File] to get the variables from the file to parameters.

     

    You may need to customize your script file and choice action types for your requirement. 

    If you want to perfect solution, I believe CA Services can help you.

     

    Regards

    Yas



  • 3.  Re: Export command in unix

    Broadcom Employee
    Posted Jul 11, 2018 10:14 PM

    Hi,

     

    Did my answer help you?

    If so, please click "Mark Correct" on the answer. If you need additional help, please share details of your attempt and situation.

     

    Thanks in advance.

    Yas



  • 4.  Re: Export command in unix

    Broadcom Employee
    Posted Jul 13, 2018 10:19 AM

    Hi Dada,

     

    Did the answer Yas provide help? If so, please "mark correct". If not, please clarify exactly what you're trying to do (who, what, why, where, how) so that we can understand the business case better. I'm also having a hard time understanding the objective. 

     

    If you need to run something as m00431 but need an operating system level environment variable set first for that user then I think you have one or two options:

    1. use the run command line action. set the properties to run as m00431. in the command set it to run the command: export VAR=Value; <run whatever other command you want it to run>

      Note: The export environment variable is temporary because its being set in that session. That is why I'm advising you to run whatever command you want it to run after appending a semi-colon to the export of an environment variable. If you need a persistent environment variable for user m00431 then you'll need to add it to an appropriate profile (ex: /home/m00431/.bashrc, etc..)
    2. use the run command line (ssh) action. similar to #1 you'd set it to run the command: export VAR=Value; <run whatever other command you want it to run>

     

           And similar to the note given in #1, the export is temporary. 

     

    Kind regards,

    Gregg

     



  • 5.  Re: Export command in unix

    Posted Aug 13, 2018 08:15 AM

    Thanks Gregg .. it worked for me.