Automic Workload Automation

 View Only
Expand all | Collapse all

Load /etc/profile and ~/.profile while running the jobs as login user by default shell

  • 1.  Load /etc/profile and ~/.profile while running the jobs as login user by default shell

    Posted Jul 01, 2020 10:53 AM
    Hi Everyone,
    In JOBS UNIX tab, If Shell is not selected in the start parameter, It will pick up the default shell from /etc/passwd file. If my default shell is ksh or bash in passwd file, the automic unix jobs not loading ~/.profile and /etc/profile values. As mentioned in this document looks like it is carrying only a limited variable i.e LOGNAME to jobs.
    https://knowledge.broadcom.com/external/article?articleId=90167&_ga=2.22321407.517722746.1593600276-168491568.1564031658

    I have to explicitly select the shell as "-ksh" or "-bash" to load profile. Is there any way to load profile file by default without explicitly selecting the shell option in unix jobs?

    ------------------------------
    Selvam
    ------------------------------


  • 2.  RE: Load /etc/profile and ~/.profile while running the jobs as login user by default shell

    Posted Jul 01, 2020 10:59 AM
    Edited by Carsten Schmitz Jul 01, 2020 11:01 AM
    Hi Selvam.

    I don't think so, and it also goes against UNIX concepts: plainly executing something does not give your a login shell and thus doesn't source the .profile files.

    You could, however, create an Automic Include and include it your jobs. That Include can then detect the shell and source the appropriate files. Maybe something like:

    if [ $(basename $SHELL) == "bash" ] ; then source /etc/profile ; fi

    Regards,

    p.s. that approach may of course fail if the actual shell isn't compatible with the syntax at all

    ------------------------------
    # -------------------------------------------------------------------
    # signature.sh --verbose=[true|false]
    # no configurables beyond this point, only signature

    Calendar Quote of the Month:
    "The point of a DR test with a remote site is usually to be operational when your main site gets flooded / set on fire / invaded by Ninjas at an inconvenient moment."

    Did you know?
    Using the slide show widget for posting individual images is wrong! Please use the "insert image" button in the editor.

    Pro Tip: I will NOT respond to PM asking for help unless there's an actual reason to keep the discussion off of the public forums!

    'Efficient Solutions Monthly Magazine' says:
    "Asking questions the right way never hurts!"

    Here, have some tips:
    http://www.catb.org/~esr/faqs/smart-questions.html
    https://www.chiark.greenend.org.uk/~sgtatham/bugs.html
    ------------------------------