karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olivier Armand (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-2890) The env variables can't be read while running karaf as a Linux service
Date Fri, 25 Jul 2014 20:00:46 GMT

    [ https://issues.apache.org/jira/browse/KARAF-2890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14074839#comment-14074839
] 

Olivier Armand commented on KARAF-2890:
---------------------------------------

Jean-Baptiste,
I initially opened the Talend support ticket with the suggested fix, from which Xilai open
this JIRA.

The "/bin/sh" in the command is indeed an issue for us, on RHEL.
Here are few commands to show you why (run on an Ubuntu 13.10, but the behavior is similar
on RHEL) :
{code}
$ cp ~/.bash_profile ~/.bash_profile.bck && echo "export test=hello" > ~/.bash_profile
&& su - -m $USER -s /bin/sh -c 'echo $test' && mv ~/.bash_profile.bck ~/.bash_profile
{code}
Nothing is displayed, "hello" was expected.
Let's remove the "/bin/sh" part:
{code}
$ cp ~/.bash_profile ~/.bash_profile.bck && echo "export test=hello" > ~/.bash_profile
&& su - -m $USER -c 'echo $test' && mv ~/.bash_profile.bck ~/.bash_profile
{code}
Here comes the "hello" output.

Here's why:
{code}
$ grep $USER /etc/passwd
olivier:x:1000:1000:Olivier Armand,,,:/home/olivier:/bin/bash
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 mars  29 14:46 /bin/sh -> dash
{code}

My default shell is bash, /bin/sh is actually dash. I'm expected Karaf to run with bash.

> The env variables can't be read while running karaf as a Linux service
> ----------------------------------------------------------------------
>
>                 Key: KARAF-2890
>                 URL: https://issues.apache.org/jira/browse/KARAF-2890
>             Project: Karaf
>          Issue Type: Bug
>    Affects Versions: 2.3.3
>            Reporter: Xilai Dai
>            Assignee: Jean-Baptiste Onofré
>             Fix For: 4.0.0, 3.0.2, 2.4.1, 2.3.7
>
>
> Install karaf as a Linux service following steps:
> 1. features:install wrapper
> 2. wrapper:install -s AUTO_START -n talend-runtime -d talend-runtime -D "Talend Runtime
Service"
> $ ln -s /Talend/runtime/bin/talend-runtime-service /etc/init.d/talend-runtime
> the fragment from generated script:
> {code}
> # Still want to change users, recurse.  This means that the user will only be
> #  prompted for a password once.
>   su -m $RUN_AS_USER -s /bin/sh -c "$REALPATH $1"
> {code}
> it should be:
> {code}
>  # Still want to change users, recurse.  This means that the user will only be
>  #  prompted for a password once.
>  su - -m $RUN_AS_USER -c "$REALPATH $1"
> {code}
> Because the user login script (.bash_profile) can't be executed without '-' after 'su';
and '-s /bin/sh' is not standard, the default shell of the run_as user (e.g. bash) should
be used.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message